Author Login
Post Reply
user Digest 3 Apr 2008 10:06:35 -0000 Issue 7961
Topics (messages 184980 through 184996):
Re: Security @ Struts2, using Acegy or Inspector
184980 by: Frans Thamura
184988 by: Lukasz Lenart
Re: rrrrr...why my field returns null????
184981 by: xianwinwin
Re: Hidden field null in IE
184982 by: phms
<s:radio> issue
184983 by: Niral Trivedi
Re: Struts 2.1 TabbedPanel scenario
184984 by: Shoaib Gauhar
Re: Actionerrors & the Store Interceptor
184985 by: Al Sutton
184986 by: Chris Pratt
Re: xml based validation vs Annotations based validation
184987 by: Lukasz Lenart
Re: [S2] Menu Tag Library struts-config.xml problem.
184989 by: sassien
184993 by: Laurie Harper
[DEV-IMPLICATIONS] Re: Actionerrors & the Store Interceptor
184990 by: Al Sutton
Re: [S2] checkboxes in each row of table - set values in action
184991 by: lbastil
184994 by: Laurie Harper
Re: Regarding Service layer getting called twice
184992 by: Prajapati Manish Narandas
Re: struts.xml
184995 by: Adam Hardy
org.apache.jasper.JasperException: tag 'select'
184996 by: Alex Shneyderman
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184980.ezm (zipped)> If you anticipate having the complexity of a full ACL implementation, I'd
> just go ahead and use AceGI; why re-invent all that machinery? If you decide
> to roll your own, though, then the interceptor can access the action through
> the ActionInvocation object and, through the action, can access your POJO
> via whatever mechanism you want -- via ModelDriven's getModel() method,
> through an interceptor-specific interface you design, or whatever.
my idea is to make a class that extend Action
so, if I extend this action, the action will query and get security
permission from database.. because i prefer database driven ..
but i thinking a interceptor, but new in this area, i prefer a pattern that
filter any action
but.. i am loking also in AOP of spring or may be a HTTPFilter mechanism
(still dont know, how to implement Struts2 based in the httpfilter)
F

Attachment:
user_184988.ezm (zipped)Hi,
> so, if I extend this action, the action will query and get security
> permission from database.. because i prefer database driven ..
You can do this with Acegi and even combine database with LDAP or with
something else.
I have used such solution in my projects.
> but i thinking a interceptor, but new in this area, i prefer a pattern that
> filter any action
Here you have simple solution how to integrate Acegi with Struts2
http://struts.apache.org/2.x/docs/can-we-use-acegi-security-with-the-framework.html
Regards
--
Lukasz
http://www.linkedin.com/in/lukaszlenart

Attachment:
user_184981.ezm (zipped)
thank you Laurie for your reply.
I made a type - its str not the Note. so the str is null :-(
when I remove the theme="ajax" it works fine. BUT I need it there (the idea
that the form will disappear once the action is completed).
how do I get the value of the str? rrrrrr :-(
I've been trying different variation - nothing!
thanks for any pointer!
Laurie Harper wrote:
>
> Your action doesn't have a bean of name/type Note, it only has a single
> String property 'str'. Did you mean this property is not being set? From
> the code you've included, it should be set from the textfield so you
> must have something configured wrong. What does your action mapping look
> like? Are you using the default interceptor stack or have you specified
> a different one?
>
> L.
>
> xianwinwin wrote:
>> Can anyone advise why my bean is null.
>>
>> I have the following jsp page:
>>
>> <html>
>> <head>
>> <s:head theme="ajax"/>
>> </head>
>> <body>
>>
>> <s:form
>> theme="ajax"
>> id="myForm"
>> cssStyle="font-size : 8pt; font-family: verdana"
>> action="notes_insert"
>> method="post" >
>>
>> <s:textarea rows="5" cols="60" name="str" label="Add Note"
>> required="true"/>
>>
>>
>> <s:submit align="center" targets="myForm" theme="ajax"/>
>>
>> </s:form>
>>
>> when the user cllicks submit - the action 'insert' kicksin but the bean
>> (Note) is null (yes, i have getter and setter)
>>
>>
>>
>>
>> //action
>> @Validation
>> public class NoteAction extends BaseSupport implements Serializable
>> {
>> private String str;
>>
>>
>> @SkipValidation
>> public String insert()
>> {
>> System.out.println("the value is "+ str);
>> }
>>
>>
>> public String getStr()
>> {
>> return str;
>> }
>>
>> public void setStr(String str)
>> {
>> this.str = str;
>> }
>> }
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184982.ezm (zipped)
Ok. Lets go:
I have a javascript function that sets a value of a hidden field :
hidden field: <html:hidden property="mode" styleId="mode"/>
Javascript function:
function adiciona(){
document.getElementById('mode').value='add';
}
In my form i have a <html:image where i call the function:
<html:image src="imagens/bot_ad_grupo.gif" border="0" property="Submit"
value="Submit" alt="Submit" onclick="adiciona()"/>
The problem is that the field is not set when i am using IE.
--
newton.dave wrote:
>
> Can you reduce that to a minimal use-case and repost? It's hard to wade
> through that much HTML/JavaScript/Java/JSP to find out what's actually
> happening.
>
> Dave
>
> --- phms <pedrinho.k2@(protected):
>
>>
>> Folks,
>>
>> I have a JSP page in which i need to set a hidden field (mode) using
>> javascript and send it to a form using struts. The code works on Firefox
>> but in IE the field is not modifyed (null). Below is my code:
>>
>> <%@(protected)" %>
>> <%@(protected)" %>
>> <%@(protected)" %>
>> <%@(protected)" %>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>>
>> <%@(protected)" %>
>> <%@(protected)" %>
>> <%@(protected)" %>
>> <%@(protected)" %>
>> <%@(protected)
>> import="com.redewireless.psiw.applications.smsmanager.model.SmsGroup" %>
>> <%@(protected)
>> import="com.redewireless.psiw.applications.smsmanager.model.SmsGroupMember"
>> %>
>> <%@(protected)" %>
>>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
>> />
>> <title>mobiw : Plataforma de Serviços de Interatividade Wireless</title>
>> </head>
>>
>> <link href="css/css_main.css" rel="stylesheet" type="text/css" />
>>
>>
>> <link rel="stylesheet" href="css/new.css" type="text/css" media="screen"
>> />
>>
>>
>> <link title="calendar-brown" href="js/calendar-smsp.css" media="all"
>> type="text/css" rel="stylesheet" />
>>
>> <script type="text/javascript" src="js/calendar.js"></script>
>> <script src="js/calendar-pt.js" type="text/javascript"></script>
>> <script src="js/calendar-setup.js" type="text/javascript"></script>
>> <script type="text/javascript" src="js/overlib.js"></script>
>> <script type="text/javascript" src="js/overFunc.js"></script>
>> <script type="text/javascript" src="js/j.js"></script>
>>
>> <script language="JavaScript" type="text/javascript">
>> <!--
>> var helpFrame='<!--[if lte IE 6.5]><iframe></iframe><![endif]-->';
>>
>> function adiciona(){
>> document.forms[0].smsGroupId.value="";
>> document.forms[0].name.value="";
>> document.forms[0].description.value="";
>> document.forms[0].mode.value="add";
>> document.forms[0].submit();
>> return true;
>> }
>> -->
>> </script>
>> <body bgcolor="#eeeeee" leftmargin="0" topmargin="0" rightmargin="0"
>> bottommargin="0" marginwidth="0" marginheight="0">
>>
>> <%
>> //Global variables
>> Facade facade = Facade.getInstance();
>> PsiwUser user = (PsiwUser)
>> request.getSession().getAttribute(Constants.USER_KEY);
>> List<SmsGroup> groups = facade.getSmsGroups(user);
>> %>
>>
>> <div class="select-free" id="overDiv" style="position:absolute;
>> visibility:hidden; z-index:10000;"></div>
>> imagens/espaco.gif <br />
>> <div align="center">
>>
>> <table width="763" border="0" cellspacing="0" cellpadding="0">
>> <tr>
>> <td> imagens/topo_sec.gif <br /></td>
>> </tr>
>> <tr>
>> <td background="imagens/bg_sec.gif" align="center">
>> <%@(protected)" %>
>> <br /><br />
>> </td>
>> </tr>
>> <tr>
>> <td background="imagens/bg_sec.gif" align="center">
>> <!-- CONTEÚDO DA PÁGINA -->
>> <table width="745" border="0" cellspacing="0" cellpadding="0">
>> <html:form styleId="manageSmsGroupForm" method="POST"
>> action="ManageSmsGroup" enctype="multipart/form-data">
>> <html:hidden property="mode" styleId="mode"/>
>> <html:hidden property="name" styleId="name"/>
>> <html:hidden property="description" styleId="description"/>
>> <html:hidden property="smsGroupId" styleId="smsGroupId"/>
>> <html:hidden property="page" styleId="page" value="0"/>
>> <tr>
>> <td align="left">
>>
>> sec_msg_menu_operacoes.jsp GERENCIAMENTO DE ENVIO DE MENSAGENS >
>> GERENCIAMENTO DE GRUPOS
>> <br /><br />
>>
>> </td>
>> </tr>
>>
>> <tr>
>> <td align="left">
>>
>> imagens/seta_cinza.gif <strong>Gerenciamento de grupos</strong><br
>> /><br />
>>
>>
>> <!-- MENSAGEM DE SUCESSO OU ERRO -->
>> <table width="100%" border="0" cellspacing="0" cellpadding="0">
>> <tr>
>> <logic:equal name="status" value="success">
>> <td background="imagens/linha_sucesso.gif" align="center"
>> valign="middle" height="32">
>>
>> Operação realizada com sucesso!<br />
>>
>> </td>
>> </logic:equal>
>> <logic:equal name="status" value="error">
>> <td background="imagens/linha_erro.gif" align="center"
>> valign="middle" height="32">
>>
>> Operação não pôde ser realizada. Tente novamente mais tarde.<br
>> />
>>
>> </td>
>> </logic:equal>
>> </tr>
>> </table>
>> <logic:notEqual name="status" value="none">
>> <br />
>> </logic:notEqual>
>> <!-- MENSAGEM DE SUCESSO OU ERRO -->
>> <%
>> if(groups != null && groups.size() > 0){
>> %>
>> <!-- tabela de GRUPOS -->
>> <table width="740" border="0" cellspacing="2" cellpadding="4">
>> <tr>
>> <td bgcolor="#f3efe9" align="center" valign="middle"
>> width="30">Id<br
>> /></td>
>> <td bgcolor="#f3efe9" align="center" valign="middle"
>> width="135">Nome
>> do grupo<br /></td>
>> <td bgcolor="#f3efe9" align="center" valign="middle"
>> width="385">Descrição<br /></td>
>> <td bgcolor="#f3efe9" align="center" valign="middle"
>> width="75">Editar<br /></td>
>> <td bgcolor="#f3efe9" align="center" valign="middle"
>> width="75">Excluir<br /></td>
>> </tr>
>> <%
>> String groupId;
>> String groupName;
>> String groupDescription;
>>
>> String removeButton;
>> String editButton;
>>
>> for(int i = 0; i < groups.size(); i++){
>> groupId = Long.toString(groups.get(i).getSmsGroupId());
>> groupName = groups.get(i).getName();
>> groupDescription = groups.get(i).getDescription();
>>
>> editButton = "document.getElementById('smsGroupId').value='" +
>> groupId + "';document.getElementById('name').value='" + groupName +
>> "';document.getElementById('description').value='" + groupDescription +
>> "';document.getElementById('mode').value='edit';";
>> removeButton = "document.getElementById('smsGroupId').value='" +
>> groupId + "';document.getElementById('name').value='" + groupName +
>> "';document.getElementById('description').value='" + groupDescription +
>> "';document.getElementById('mode').value='rem';";
>> %>
>> <tr>
>> <td bgcolor="#eeeeee" align="center" valign="middle">
>> <%=groupId%><br />
>> </td>
>> <td bgcolor="#eeeeee" align="left" valign="middle">
>> <strong><%=groupName%></strong><br />
>> </td>
>> <td bgcolor="#eeeeee" align="left" valign="middle">
>> <%=WordWrapper.wrapTextByColumnWidth(groupDescription, 385)%><br
>> />
>> </td>
>> <td bgcolor="#eeeeee" align="center" valign="middle">
>> <html:image src="imagens/bot_exclamacao.gif" border="0"
>> property="Submit" value="Submit" alt="Submit"
>> onmouseover="overlib(helpFrame+'Clique aqui para editar os parâmetros
>> deste
>> grupo.', CSSCLASS, FGCLASS, 'ol_class_fg', BGCLASS, 'ol_class_bg',
>> TEXTFONTCLASS, 'ol_class_fn', TIMEOUT, null, DELAY, null);"
>> onmouseout='nd()' onclick="<%=editButton%>"/><br />
>> </td>
>>
> === message truncated ===
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184983.ezm (zipped)
Attachment:
user_184984.ezm (zipped)
First of all, thanks for replying. I really appreciate it. Making a single
action class will make the classes very bulky and complex. I dont want to
have that. I used the remote tabs functionality in tabbed panel but all it
does is that it goes into a infinite recursive loop. It adds infinite number
of tabs and the page hangs. Maybe its an implementation error.
I dont know how to make the dataset common other than make one action class
which in my case is certainly achievable but not acceptable.
Let me make the scenario a bit more understandable.
I am working on a product which generates jsp pages and action classes in
struts 2. Lets suppose that the user has built two different jsps and action
classes. They work separately perfectly. Now, we are giving him the option
to make a tabbed pane by using those two sets of jsps and action classes.
One way would be to merge them and make one jsp and one action class. Which
in my case is again achievable but very complex and the code will not be
readable. The next idea which came to my mind (i dont know if it is
achievable or not) is to make one jsp but have two separate action classes.
Each tab remotely accessing the dataset of each action class.
There is no other idea which is coming to my mind at the moment. So, any
other idea will be highly appreciated. The worst thing is that the solution
must be generic. :,(
Thanks again,
Shoaib Ahmad Gauhar
Laurie Harper wrote:
>
> Shoaib Gauhar wrote:
>> Hello,
>>
>> Here is the scenrio. I have two action classes. ClassA and ClassB. There
>> is
>> no relationship among these classes. You might say that if there is no
>> relationship then why i have to put them in one single jsp. Well its a
>> client's requirement.
>
> That's an implementation detail, not a functional requirement. Why does
> the client care how you structure your actions?
>
>> In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.
>>
>> Each tab has fields concerned to their classes as defined above. Tab1 ->
>> ClassA and Tab2 -> ClassB.
>>
>> Can we do it? I have tried this but what happens is that when i submit
>> the
>> data on Tab1, Tab2's data becomes empty.
>
> A request is only processed by one action. If you need both actions to
> be able to process all the input from both tabs, you'll have to have
> them both aware of the full dataset. There are a number of ways you
> might achieve that, depending on what you're trying to achieve.
>
>> So, any ideas will be highly appreciated. Furthermore, i am quite new to
>> tabbed panel and would require clear tips and ideas.
>
> I haven't used that widget in Struts 2 so can't offer specific tips.
> However, if you start by defining the functional requirements (rather
> than the implementation details), it'll be easier to offer advice.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184985.ezm (zipped)Chris,
I've used the StoreInterceptor and my opinion is that it just isn't flexible
enough to use.
To illustrate the point, consider try following;
1) You have a View Action which displays all of the data of a specific type,
which uses the StoreInterceptor in retrieve in order to show confirmation
messages from an Update action.
2) You have an Edit Action which sends the user to edit.jsp via the
dispatcher result type. edit.jsp has a menu taking the user to other places
in the app.
3) You have an Update Action which is called by submitting a form on
edit.jsp, this can return the user to edit.jsp using the dispatcher if there
is a problem with the form data, or it can take the user to the View Action
via a redirect if everything is OK. The Update Action uses the
StoreInterceptor in STORE mode in order to send a confirmation back to the
View Action.
Now, if the user gets to the edit stage submits the form, but has made a
mistake which sends them back to edit.jsp, clicks on the menu to go to
another action they end up seeing the error message twice, once when the get
redirected back to edit.jsp from the UpdateAction, and a second time when
they click on any of the links from the menu on edit.jsp.
If you want to track the resolution of this, you may want to look at the
JIRA issue I raised about 10 months ago...
https://issues.apache.org/struts/browse/WW-1963
Al.
----- Original Message -----
From: "Chris Pratt" <thechrispratt@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Wednesday, April 02, 2008 10:55 PM
Subject: Re: Actionerrors & the Store Interceptor
> Sorry Lucas, I'm still not seeing how that will help differentiate
> between which result's need the messages collected and which don't?
>
> And I have to agree with Laurie, that I don't understand the
> difference between the store interceptor and what you're proposing.
> (*Chris*)
>
> On Wed, Apr 2, 2008 at 2:47 PM, Lukasz Lenart
> <lukasz.lenart@(protected):
>> > Umm, that's what the Store Interceptor is.
>>
>> Not exactly, you have to specify for which action store the messages,
>> and for which retrieve them back. There is no magic, everything hand
>> coded ;-)
>>
>>
>>
>> Regards
>> --
>> Lukasz
>>
>> http://www.linkedin.com/in/lukaszlenart
>>
>> ---------------------------------------------------------------------
>>
>>
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_184986.ezm (zipped)On Wed, Apr 2, 2008 at 11:17 PM, Al Sutton <al.sutton@(protected):
> Chris,
>
> I've used the StoreInterceptor and my opinion is that it just isn't
> flexible enough to use.
>
> To illustrate the point, consider try following;
>
> 1) You have a View Action which displays all of the data of a specific
> type, which uses the StoreInterceptor in retrieve in order to show
> confirmation messages from an Update action.
>
> 2) You have an Edit Action which sends the user to edit.jsp via the
> dispatcher result type. edit.jsp has a menu taking the user to other places
> in the app.
>
> 3) You have an Update Action which is called by submitting a form on
> edit.jsp, this can return the user to edit.jsp using the dispatcher if there
> is a problem with the form data, or it can take the user to the View Action
> via a redirect if everything is OK. The Update Action uses the
> StoreInterceptor in STORE mode in order to send a confirmation back to the
> View Action.
>
> Now, if the user gets to the edit stage submits the form, but has made a
> mistake which sends them back to edit.jsp, clicks on the menu to go to
> another action they end up seeing the error message twice, once when the get
> redirected back to edit.jsp from the UpdateAction, and a second time when
> they click on any of the links from the menu on edit.jsp.
>
> If you want to track the resolution of this, you may want to look at the
> JIRA issue I raised about 10 months ago...
> https://issues.apache.org/struts/browse/WW-1963
>
Yup, that pretty much describes exactly what we're seeing. I think
the simplest fix would be to add a parameter to the <s:actionerror>,
<s:actionmessage> and <s:fielderror> tags, something like
remove="true", that when the message has been displayed, it removes it
from the list. That way, if the result ends up forwarding rather than
redirecting, and the messages get shown and removed, there will be
nothing for the store interceptor to store and the messages will be
displayed only once.
It should be a fairly simple fix and be completely backward compatible
with anyone showing the messages multiple times on purpose.
Unfortunately I haven't been able to find a good work-around to this
and I really don't have the time in my project to not only learn the
code well enough to make this change, but then learn maven and enough
of the build procedures to integrate it into my project. I would love
to hear from ANYONE who has figured a way out of this spiral. Thanks.
(*Chris*)

Attachment:
user_184987.ezm (zipped)Hi,
> Wanted to get opinion from the struts2 user community if there are any
> advantages/disadvantages of using one approach over another (Xml vs Annotation
> based validation).
Nope ;-)
There is no one good answer for your question, because it depends ;-)
For me, the best thing is, you can combine all this two approach
together and even more, add method base validation (validate() and
validateXXX() ) to this stack.
I made some small test app to show such approach, you can download it
from here http://jdn.pl/files/test-app_0.zip (the site is in Polish
;-)
Regards
--
Lukasz
http://www.linkedin.com/in/lukaszlenart

Attachment:
user_184989.ezm (zipped)
Of course, but in this page there is a section "To upgrade from Struts Menu
1.x to Struts Menu 2.x"... So I guess it should work with this. I wouldn't
have even tried if there hadn't been this section...
Anyway, I think someone managed already, and I would like to know how to
configure the files... %-|
newton.dave wrote:
>
> I don't know about S2/Struts-Menu integration, but I guarantee you that
> blindly following instructions for an S1 application has no chance of
> working
> in a typical S2 application.
>
> Dave
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184993.ezm (zipped)That's talking about upgrading from 1.x to 2.x of Struts Menu isn't it?
I had a quick look at their Getting Started docs, and I think you would
want to follow the "Using Struts Menu outside of Struts" documentation.
The only thing I see that's Struts 1 specific is the plug-in
configuration in struts-config.xml (a configuration file that is not
used in Struts 2).
L.
sassien wrote:
> Of course, but in this page there is a section "To upgrade from Struts Menu
> 1.x to Struts Menu 2.x"... So I guess it should work with this. I wouldn't
> have even tried if there hadn't been this section...
> Anyway, I think someone managed already, and I would like to know how to
> configure the files... %-|
>
>
>
> newton.dave wrote:
>> I don't know about S2/Struts-Menu integration, but I guarantee you that
>> blindly following instructions for an S1 application has no chance of
>> working
>> in a typical S2 application.
>>
>> Dave
>>
>

Attachment:
user_184990.ezm (zipped)Chris,
I'm familiar with the code, but the main problem is that there is a "paper
wall" between the StoreInterceptor and the jsp tags, so that one does not
know or rely on how the other works.
As far as I'm aware this is only a philosophical decision, and there is no
technical reason why the tags can't removed information stored in the
StoreInterceptor, but I'm pretty sure it would need the nod of those on the
dev list to get into the final build.
Al.
----- Original Message -----
From: "Chris Pratt" <thechrispratt@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Thursday, April 03, 2008 7:31 AM
Subject: Re: Actionerrors & the Store Interceptor
> On Wed, Apr 2, 2008 at 11:17 PM, Al Sutton <al.sutton@(protected):
>> Chris,
>>
>> I've used the StoreInterceptor and my opinion is that it just isn't
>> flexible enough to use.
>>
>> To illustrate the point, consider try following;
>>
>> 1) You have a View Action which displays all of the data of a specific
>> type, which uses the StoreInterceptor in retrieve in order to show
>> confirmation messages from an Update action.
>>
>> 2) You have an Edit Action which sends the user to edit.jsp via the
>> dispatcher result type. edit.jsp has a menu taking the user to other
>> places
>> in the app.
>>
>> 3) You have an Update Action which is called by submitting a form on
>> edit.jsp, this can return the user to edit.jsp using the dispatcher if
>> there
>> is a problem with the form data, or it can take the user to the View
>> Action
>> via a redirect if everything is OK. The Update Action uses the
>> StoreInterceptor in STORE mode in order to send a confirmation back to
>> the
>> View Action.
>>
>> Now, if the user gets to the edit stage submits the form, but has made a
>> mistake which sends them back to edit.jsp, clicks on the menu to go to
>> another action they end up seeing the error message twice, once when the
>> get
>> redirected back to edit.jsp from the UpdateAction, and a second time when
>> they click on any of the links from the menu on edit.jsp.
>>
>> If you want to track the resolution of this, you may want to look at the
>> JIRA issue I raised about 10 months ago...
>> https://issues.apache.org/struts/browse/WW-1963
>>
>
> Yup, that pretty much describes exactly what we're seeing. I think
> the simplest fix would be to add a parameter to the <s:actionerror>,
> <s:actionmessage> and <s:fielderror> tags, something like
> remove="true", that when the message has been displayed, it removes it
> from the list. That way, if the result ends up forwarding rather than
> redirecting, and the messages get shown and removed, there will be
> nothing for the store interceptor to store and the messages will be
> displayed only once.
>
> It should be a fairly simple fix and be completely backward compatible
> with anyone showing the messages multiple times on purpose.
>
> Unfortunately I haven't been able to find a good work-around to this
> and I really don't have the time in my project to not only learn the
> code well enough to make this change, but then learn maven and enough
> of the build procedures to integrate it into my project. I would love
> to hear from ANYONE who has figured a way out of this spiral. Thanks.
> (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_184991.ezm (zipped)
Thank you for reply!
I just wonder:
I understand it would work out of box for 1 User-Object, if I bound checkbox
to permission property of this user.
But I wonder it should work out of box if I use (as I described) Collection
of Users in Action
and on jsp side iterator tag, and checkbox tag within iterator is bound to
permission properties of users in the iterated Collection.
This does not matter, it should work the same as for single user object?
Thank you,
Basti
Laurie Harper wrote:
>
> lbastil wrote:
>> Hello,
>>
>> I have the following problem:
>>
>> in action i have a collection of class User
>> each class User have different attributes, one is: boolean permission
>>
>> in JSP I use struts 2 iterator tag to iterate the User Objects.
>> For each User entry I create one row in table.
>> for displaying/changing the boolean permission value I use S2 checkbox
>> tag
>>
>> so far it works fine and show all data in collection of Users correct.
>>
>> But how can I set changed checkbox values (the permission attribute) back
>> to
>> action?
>
> If your checkbox is bound the the permission property of the user,
> submitting the form should update the property. If that's not happening,
> you need to give more details: what your JSP code looks like, and the
> relevant bits of your action and User code, at least.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184994.ezm (zipped)Provided the checkbox is properly bound to the collection entry, yes.
You need to specify the name of the s:checkbox (or any other input type)
as userCollection[index].userProperty where 'userCollection' is the name
of the Collection property on your action, index comes from the iterator
and userProperty is the property to bind to.
L.
lbastil wrote:
> Thank you for reply!
>
> I just wonder:
>
> I understand it would work out of box for 1 User-Object, if I bound checkbox
> to permission property of this user.
> But I wonder it should work out of box if I use (as I described) Collection
> of Users in Action
> and on jsp side iterator tag, and checkbox tag within iterator is bound to
> permission properties of users in the iterated Collection.
>
> This does not matter, it should work the same as for single user object?
>
>
> Thank you,
> Basti
>
>
> Laurie Harper wrote:
>> lbastil wrote:
>>> Hello,
>>>
>>> I have the following problem:
>>>
>>> in action i have a collection of class User
>>> each class User have different attributes, one is: boolean permission
>>>
>>> in JSP I use struts 2 iterator tag to iterate the User Objects.
>>> For each User entry I create one row in table.
>>> for displaying/changing the boolean permission value I use S2 checkbox
>>> tag
>>>
>>> so far it works fine and show all data in collection of Users correct.
>>>
>>> But how can I set changed checkbox values (the permission attribute) back
>>> to
>>> action?
>> If your checkbox is bound the the permission property of the user,
>> submitting the form should update the property. If that's not happening,
>> you need to give more details: what your JSP code looks like, and the
>> relevant bits of your action and User code, at least.
>>
>> L.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>

Attachment:
user_184992.ezm (zipped)Thanx Laurie,
Actually issue was in button 's hyperlink .we were calling same function on
both href and onclick event.Actually yesterday we tried to find out weather
action
is getting called twice or not but might be we some were failed to notice it
but today morning
after your mail i again tried and i found it.
Regards,
Manish
On Thu, Apr 3, 2008 at 2:04 AM, Laurie Harper <laurie@(protected):
> Struts invokes your actions, not your service layer, so the first step is
> to determine where the calls to the service layer are coming from. Either
> your action is doing that or your action is being called more than once
> during one 'logical request' -- which would probably mean the browser was
> issuing more than one request to the action while building the page, unless
> you're using s:action or something. Figure out what's happening at the
> action level first, then work backwards from there.
>
> L.
>
> Prajapati Manish Narandas wrote:
>
> > Hi all,
> > i am using spring object factory action itself,service layer and Dao
> > layer.
> > Here, service layer method is getting called twice and due to that dao
> > layer
> > method is also called twice.
> > Can any body tell me what can be the reason of it?
> > This not happening service layer of all action.
> > Like i have another action class which shares the same service layer but
> > for
> > that action service layer is not
> > getting called twice.
> > Following are the all configuration files:
> >
> > *1. test1-applicationContext.xml* *(My application context file for that
> > test1 action)*
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
> > http://www.springframework.org/dtd/spring-beans.dtd">
> > <beans>
> > <import resource="datasource.xml" />
> > <import resource="test2-applicationcontext.xml" />
> > <bean id="testPreview" class="net.test1">
> > ..........
> > *<property name="itemListingService"> *
> > *<ref bean="itemListingService" /> *
> > *</property>*
> > .............
> > </bean>
> > </beans>
> >
> > *2. test2-applicationcontext.xml* *(application context file which is
> > imported in above test1 for sharing service layer)*
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
> > http://www.springframework.org/dtd/spring-beans.dtd">
> > <beans>
> > <bean id="itemListingService"
> > class="net.service.impl.ItemListingServiceImpl">
> > ..................
> > *<property name="itemListingDao">*
> > *<ref bean="ItemListingDao" />*
> > *</property>*
> > ..................
> > <property name="listingPeripheralDao">
> > <ref bean="listingPeripheralDao" />
> > </property>
> > .............
> > </bean>
> > </beans>
> >
> > *3. struts-test1.xml (struts configuration file for test1'action)*
> > **
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> > Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd ">
> > <struts>
> > <package name="AuctionPreview" extends="struts-test1Stack"
> > namespace="/test">
> > <interceptors>
> > <interceptor-stack name="auctionPreviewStack">
> > <interceptor-ref name="sigmaStack">
> > <param name="SSLInterceptor.excludeMethods">
> > showListing
> > </param>
> > <param name="ActionContextInterceptor.excludeMethods">
> > showListing,nextAllItemList,viewStatetaxMap
> > </param>
> > </interceptor-ref>
> > </interceptor-stack>
> > </interceptors>
> > <default-interceptor-ref name="auctionPreviewStack" />
> >
> > <action name="test!*" method="{1}" class="net.test1">
> > <result>/jsp/auctionpreview/success.jsp</result>
> >
> > <result
> > name="success">/jsp/auctionpreview/Main.jsp?page=auctionPreview</result>
> > .........
> > <result name="input">/jsp/auctionpreview/success.jsp</result>
> > ..........
> > <result
> >
> > name="paymentSuccess">/jsp/listing/PaymentSuccess.jsp?page=listing</result>
> > <result
> > name="paymentFail">/jsp/listing/PaymentFailure.jsp?page=listing</result>
> >
> > <result name="error">/jsp/listing/error.jsp?page=listing</result>
> > </action>
> > </package>
> > </struts>
> >
> >
> > *4.struts-test1Stack.xml (interceptor stack config file)*
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> > Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd ">
> > <struts>
> > <package name="struts-test1Stack" extends="struts-default">
> > <interceptors>
> > <interceptor name="SSLInterceptor"
> > class="net.sigmainfo.blackwells.action.SSLInterceptor" />
> > <interceptor name="ActionContextInterceptor"
> > class="net.sigmainfo.blackwells.action.ActionContextInterceptor" />
> > <interceptor name="UrlActionInterceptor"
> > class="net.sigmainfo.blackwells.action.UrlActionInterceptor" />
> > ........................
> > <interceptor-stack name="test1Stack">
> > <interceptor-ref name="UrlActionInterceptor" />
> > <interceptor-ref name="SSLInterceptor" />
> > <interceptor-ref name="GarbageCollectionInterceptor" />
> > <interceptor-ref name="defaultStack" />
> > <interceptor-ref name="ActionContextInterceptor" />
> >
> > </interceptor-stack>
> > </interceptors>
> > Summary: Here *itemListingService(Service Layer) 's method is called
> > twice
> > and because of it itemListingDao (Dao layer)'s*
> > *method is also called twice any it gives error like Invalid attempt to
> > associate collection with two open session.*
> > **
> > **
> > *Can anybody tell me why in test1 service layer is getting called
> > twice.*
> > **
> > **
> > *Please share your ideas,*
> > **
> > *Thanx in advance.*
> > **
> > *From *
> > *Manish*
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184995.ezm (zipped)Adam Hardy on 02/04/08 12:23, wrote:
> Can I have a second struts.xml in my test directory, and if so, how do I
> configure it?
>
> I'm testing some stuff using HttpUnit which launches the whole webapp in
> my tests. Having a test-only struts.xml will keep the test mappings out
> of the real webapp, allow me to drop stuff I don't need for the tests,
> and make the tests faster.
From the lack of replies, I assume the answer is 'No, you cannot have an
alternative struts.xml'.
I was checking the low-down on the wiki, where I found that the struts
configuration xml can be in multiple files listed by the property in the
struts.properties:
### A list of configuration files automatically loaded by Struts
struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
Using this property, I can set up my maven environment to filter
struts.properties as a resource and set that property explicitly, so in testing
I can have 'struts-test.xml'
This works to a limited extent, i.e. one struts.xml for all testing, another for
in-container deployment.
It's not quite ideal though, as I would prefer to choose the struts.xml on a
per-test basis.
Does anyone know of something I've missed that allows this?
Thanks
Adam

Attachment:
user_184996.ezm (zipped)