Author Login
Post Reply
user Digest 29 May 2008 16:02:51 -0000 Issue 8058
Topics (messages 186971 through 186979):
Re: AJAX form submission and optimistic locking
186971 by: Owen Berry
Re: [Struts 2] Session scope
186972 by: Milan Milanovic
186974 by: Milan Milanovic
186979 by: Milan Milanovic
Re: Session Data overlap?
186973 by: Dave Newton
S2 - convert jstl to struts syntax (accessing url parameters)
186975 by: Eric Martin
186976 by: Dave Newton
186978 by: Lukasz Lenart
log:equal tag not working
186977 by: Guneet
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_186971.ezm (zipped)On Thu, May 29, 2008 at 10:22 AM, Dave Newton <newton.dave@(protected):
> --- Owen Berry <owen.berry@(protected):
>> Problem is, if you submit your forms via AJAX (I'm using the DOJO
>> plugin) the hidden "version" field is not updated after the update,
>> and so if a user makes further changes to a form and resubmits, you
>> get an OptimisticLockException. The same problem will occur if you
>> use the Token Interceptor to prevent double submits.
>>
>> Anybody come up with a clean way to handle this?
>
> Return JSON that includes the new version and set it via JavaScript?
Thanks for the suggestion. Unless somebody comes up with something
else, this is probably the way I will look at doing this.
Owen

Attachment:
user_186972.ezm (zipped)I think that I found problem. When user click on the contents page to enter wizard page 1., execute method is called to pre-populate this page, and later he enter page 2. But when he again go to contents page and click wizard button link to enter page 1. (new) execute method is not fired at all ?! And if he doesn't click refresh execute method is not fired and all of the data is keep in session.
--
Thx, Milan Milanovic
Milan Milanovic <milanmilanovich@(protected):
17:26:28,265 WARN com.actions.WizardAction:108 - SESSION_EXECUTE: {ACEGI_SECURITY_LAST_USERNAME=milan, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
17:26:46,406 WARN com.actions.WizardAction:215 - SESSION_SAVE: {ACEGI_SECURITY_LAST_USERNAME=milan, fruits=[Fruit id=null date=Thu May 29 00:00:00 CEST 2008 number=1 weight=2.0 calories=3.0 price=null], fruit=Fruit id=null from=Mon May 12 00:00:00 CEST 2008 to=Thu May 29 00:00:00 CEST 2008, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
Milan Milanovic wrote: It is wierd, I implemented the simplest SessionAware pattern, and when I call logger.info("SESSION: " + getSession()); from my execute method it writes it, but when I call the same logger.info code from my method which is invoked when user click on the submit button on the second wizard page I got an exeption:
java.lang.NullPointerExceptionat
java.util.AbstractList.hashCode(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap$1.hashCode(SessionMap.java:125)
at
java.util.HashMap.put(Unknown Source)
at
java.util.HashSet.add(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap.entrySet (
SessionMap.java:117)
at
java.util.AbstractMap.toString(Unknown Source)
at
java.lang.String.valueOf(Unknown Source)
at
java.lang.StringBuilder.append(Unknown Source)
at com.actions.WizardAction.save(WizardAction.java:215)
...
?
--
Thx, Milan
Juan Pablo Pizarro wrote: Sorry, I supposed that the problem is the same.
Bye.
2008/5/29, Milan Milanovic :
> Is started this thread and then Juan Pablo Pizarro asked his questions. I'm not sure if we have the same problem.
>
> --
> Milan
>
> Dave Newton wrote: I'm confused; are there two people with identical problems or am I
> thread-challenged today?
>
> --- Milan Milanovic wrote:
>
> > Hi Dave,
> >
> > >There is only one session per conversation. If you're using the same
> > >session (i.e., same browser window/tab, etc.) then there shouldn't
> > be
> > >any issues.
> >
> > I'm using the same browser and tab, I'm just testing application by
> > using links in it (without logging out).
> >
> > >I'd focus first on your implementation logic. You can also check the
> > >session ID to make sure they're the same session--if they're not,
> > >something's wrong.
> >
> > O.K. I'll check this.
> >
> > --
> > Thx, Milan
> >
> > Dave Newton wrote: There is only one session
> > per conversation. If you're using the same
> > session (i.e., same browser window/tab, etc.) then there shouldn't be
> > any issues.
> >
> > I'd focus first on your implementation logic. You can also check the
> > session ID to make sure they're the same session--if they're not,
> > something's wrong.
> >
> > Dave
> >
> > --- Milan Milanovic wrote:
> >
> > > Should my action class implement SessionAware ?
> > >
> > > Milan Milanovic wrote: Hi Martin,
> > >
> > > thank you.
> > >
> > > My action package extends="struts-default", does this mean when I
> > > call
> > > ActionContext.getContext().getSession() that I doesn't have access
> > to
> > > session ?
> > >
> > > It seems to me that every creates a new session for my action
> > class,
> > > and at least two methods doesn't have access to the same session.
> > How
> > > can I manage to share my variable through multiple jsp pages for
> > one
> > > action class using the users session ?
> > >
> > > --
> > > Thx, Milan
> > >
> > > Martin wrote: Hello Milan-
> > >
> > > You can accomplish creation of HttpSession via
> > > CreateSessionInterceptor
> > >
> >
> http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/CreateSessionInterceptor.html
> > >
> > > (session parameters are available via a map which is is available
> > > via)
> > > ActionContext.getContext().getSession()
> > >
> > > If you would be amenable to using a IOC container I would look at
> > > implementing Springs SessionContextAutowiringInterceptor
> > >
> >
> http://www.opensymphony.com/webwork/api/com/opensymphony/webwork/spring/interceptor/SessionContextAutowiringInterceptor.html
> > >
> > > HTH
> > > Martin
> > >
> > > ----- Original Message -----
> > > From: "Milan Milanovic"
> > > To: "Struts Users Mailing List"
> > > Sent: Wednesday, May 28, 2008 11:08 AM
> > > Subject: Re: [Struts 2] Session scope
> > >
> > >
> > > > It seems that every request have its own scope ?!
> > > >
> > > > Milan Milanovic wrote: Hi,
> > > >
> > > > I have one action class and two pages. When first page is called,
> > > in its
> > > > execute method I remove my session variable, like this:
> > > >
> > > > ServletActionContext.getContext().getSession().remove("fruits");
> > > >
> > > > and then when form from the first jsp page is submitted user
> > enter
> > > details
> > > > in the second form and there I save those changed to session,
> > too:
> > > >
> > > > ServletActionContext.getContext().getSession().put("fruits",
> > > fruits);
> > > >
> > > > Of course, I first check if there is already fruits in session. I
> > > do this
> > > > because some maybe want to go to first page to change something
> > and
> > > then
> > > > to go again to the second page to continue entering other info.
> > > But, when
> > > > I exit both page an execute method is called (with above session
> > > remove
> > > > method), and my second page is called fruits from session are
> > read
> > > again -
> > > > they are not removed ?
> > > >
> > > > --
> > > > Thx in advance, Milan Milanovic
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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)
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_186974.ezm (zipped)I see now that execute method is not called at all, it seems that Struts 2 is creating some cache of the pages! I make link like this:
<a href="<s:url action="wizard.action" namespace="/wizard" />">Enter Wizard</a>
when user click on this, page is shown but execute method is not invoked, but all of the combo boxes in page are populated and this is done in the execute method. Here is my mapping from struts.xml for this:
<package name="wizard" namespace="/wizard" extends="struts-default">
<action name="wizard" method="execute" class="wizardAction">
<result>/pages/wizard/firstPage.jsp</result>
<result name="input">/pages/wizard/firstPage.jsp</result>
</action>
</package>
Of course action class is linked using spring:
<bean id="wizardAction" scope="prototype"
class="com.myproject.actions.WizardAction">
<constructor-arg ref="wizardService" />
</bean>
What's the problem here ?!
--
Thx, Milan
Milan Milanovic <milanmilanovich@(protected).
--
Thx, Milan Milanovic
Milan Milanovic wrote: No, actually this error is not related to session it is some exeption related to my model class. Here is session log when called from two methods:
17:26:28,265 WARN com.actions.WizardAction:108 - SESSION_EXECUTE: {ACEGI_SECURITY_LAST_USERNAME=milan, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
17:26:46,406 WARN com.actions.WizardAction:215 - SESSION_SAVE: {ACEGI_SECURITY_LAST_USERNAME=milan, fruits=[Fruit id=null date=Thu May 29 00:00:00 CEST 2008 number=1 weight=2.0 calories=3.0 price=null], fruit=Fruit id=null from=Mon May 12 00:00:00 CEST 2008 to=Thu May 29 00:00:00 CEST 2008, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
Milan Milanovic wrote: It is wierd, I implemented the simplest SessionAware pattern, and when I call logger.info("SESSION: " + getSession()); from my execute method it writes it, but when I call the same logger.info code from my method which is invoked when user click on the submit button on the second wizard page I got an exeption:
java.lang.NullPointerExceptionat
java.util.AbstractList.hashCode(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap$1.hashCode(SessionMap.java:125)
at
java.util.HashMap.put(Unknown Source)
at
java.util.HashSet.add(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap.entrySet (
SessionMap.java:117)
at
java.util.AbstractMap.toString(Unknown Source)
at
java.lang.String.valueOf(Unknown Source)
at
java.lang.StringBuilder.append(Unknown Source)
at com.actions.WizardAction.save(WizardAction.java:215)
...
?
--
Thx, Milan
Juan Pablo Pizarro wrote: Sorry, I supposed that the problem is the same.
Bye.
2008/5/29, Milan Milanovic :
> Is started this thread and then Juan Pablo Pizarro asked his questions. I'm not sure if we have the same problem.
>
> --
> Milan
>
> Dave Newton wrote: I'm confused; are there two people with identical problems or am I
> thread-challenged today?
>
> --- Milan Milanovic wrote:
>
> > Hi Dave,
> >
> > >There is only one session per conversation. If you're using the same
> > >session (i.e., same browser window/tab, etc.) then there shouldn't
> > be
> > >any issues.
> >
> > I'm using the same browser and tab, I'm just testing application by
> > using links in it (without logging out).
> >
> > >I'd focus first on your implementation logic. You can also check the
> > >session ID to make sure they're the same session--if they're not,
> > >something's wrong.
> >
> > O.K. I'll check this.
> >
> > --
> > Thx, Milan
> >
> > Dave Newton wrote: There is only one session
> > per conversation. If you're using the same
> > session (i.e., same browser window/tab, etc.) then there shouldn't be
> > any issues.
> >
> > I'd focus first on your implementation logic. You can also check the
> > session ID to make sure they're the same session--if they're not,
> > something's wrong.
> >
> > Dave
> >
> > --- Milan Milanovic wrote:
> >
> > > Should my action class implement SessionAware ?
> > >
> > > Milan Milanovic wrote: Hi Martin,
> > >
> > > thank you.
> > >
> > > My action package extends="struts-default", does this mean when I
> > > call
> > > ActionContext.getContext().getSession() that I doesn't have access
> > to
> > > session ?
> > >
> > > It seems to me that every creates a new session for my action
> > class,
> > > and at least two methods doesn't have access to the same session.
> > How
> > > can I manage to share my variable through multiple jsp pages for
> > one
> > > action class using the users session ?
> > >
> > > --
> > > Thx, Milan
> > >
> > > Martin wrote: Hello Milan-
> > >
> > > You can accomplish creation of HttpSession via
> > > CreateSessionInterceptor
> > >
> >
> http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/CreateSessionInterceptor.html
> > >
> > > (session parameters are available via a map which is is available
> > > via)
> > > ActionContext.getContext().getSession()
> > >
> > > If you would be amenable to using a IOC container I would look at
> > > implementing Springs SessionContextAutowiringInterceptor
> > >
> >
> http://www.opensymphony.com/webwork/api/com/opensymphony/webwork/spring/interceptor/SessionContextAutowiringInterceptor.html
> > >
> > > HTH
> > > Martin
> > >
> > > ----- Original Message -----
> > > From: "Milan Milanovic"
> > > To: "Struts Users Mailing List"
> > > Sent: Wednesday, May 28, 2008 11:08 AM
> > > Subject: Re: [Struts 2] Session scope
> > >
> > >
> > > > It seems that every request have its own scope ?!
> > > >
> > > > Milan Milanovic wrote: Hi,
> > > >
> > > > I have one action class and two pages. When first page is called,
> > > in its
> > > > execute method I remove my session variable, like this:
> > > >
> > > > ServletActionContext.getContext().getSession().remove("fruits");
> > > >
> > > > and then when form from the first jsp page is submitted user
> > enter
> > > details
> > > > in the second form and there I save those changed to session,
> > too:
> > > >
> > > > ServletActionContext.getContext().getSession().put("fruits",
> > > fruits);
> > > >
> > > > Of course, I first check if there is already fruits in session. I
> > > do this
> > > > because some maybe want to go to first page to change something
> > and
> > > then
> > > > to go again to the second page to continue entering other info.
> > > But, when
> > > > I exit both page an execute method is called (with above session
> > > remove
> > > > method), and my second page is called fruits from session are
> > read
> > > again -
> > > > they are not removed ?
> > > >
> > > > --
> > > > Thx in advance, Milan Milanovic
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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)
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_186979.ezm (zipped)I'm sorry for this number of messages on this topic, but I now found that it works good in Firefox. Does anyone knows what is the problem ?
Milan Milanovic <milanmilanovich@(protected):
">Enter Wizard
when user click on this, page is shown but execute method is not invoked, but all of the combo boxes in page are populated and this is done in the execute method. Here is my mapping from struts.xml for this:
/pages/wizard/firstPage.jsp
/pages/wizard/firstPage.jsp
Of course action class is linked using spring:
class="com.myproject.actions.WizardAction">
What's the problem here ?!
--
Thx, Milan
Milan Milanovic wrote: I think that I found problem. When user click on the contents page to enter wizard page 1., execute method is called to pre-populate this page, and later he enter page 2. But when he again go to contents page and click wizard button link to enter page 1. (new) execute method is not fired at all ?! And if he doesn't click refresh execute method is not fired and all of the data is keep in session.
--
Thx, Milan Milanovic
Milan Milanovic wrote: No, actually this error is not related to session it is some exeption related to my model class. Here is session log when called from two methods:
17:26:28,265 WARN com.actions.WizardAction:108 - SESSION_EXECUTE: {ACEGI_SECURITY_LAST_USERNAME=milan, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
17:26:46,406 WARN com.actions.WizardAction:215 - SESSION_SAVE: {ACEGI_SECURITY_LAST_USERNAME=milan, fruits=[Fruit id=null date=Thu May 29 00:00:00 CEST 2008 number=1 weight=2.0 calories=3.0 price=null], fruit=Fruit id=null from=Mon May 12 00:00:00 CEST 2008 to=Thu May 29 00:00:00 CEST 2008, ACEGI_SECURITY_CONTEXT=org.acegisecurity.context.SecurityContextImpl@(protected)}
Milan Milanovic wrote: It is wierd, I implemented the simplest SessionAware pattern, and when I call logger.info("SESSION: " + getSession()); from my execute method it writes it, but when I call the same logger.info code from my method which is invoked when user click on the submit button on the second wizard page I got an exeption:
java.lang.NullPointerExceptionat
java.util.AbstractList.hashCode(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap$1.hashCode(SessionMap.java:125)
at
java.util.HashMap.put(Unknown Source)
at
java.util.HashSet.add(Unknown Source)
at
org.apache.struts2.dispatcher.SessionMap.entrySet (
SessionMap.java:117)
at
java.util.AbstractMap.toString(Unknown Source)
at
java.lang.String.valueOf(Unknown Source)
at
java.lang.StringBuilder.append(Unknown Source)
at com.actions.WizardAction.save(WizardAction.java:215)
...
?
--
Thx, Milan
Juan Pablo Pizarro wrote: Sorry, I supposed that the problem is the same.
Bye.
2008/5/29, Milan Milanovic :
> Is started this thread and then Juan Pablo Pizarro asked his questions. I'm not sure if we have the same problem.
>
> --
> Milan
>
> Dave Newton wrote: I'm confused; are there two people with identical problems or am I
> thread-challenged today?
>
> --- Milan Milanovic wrote:
>
> > Hi Dave,
> >
> > >There is only one session per conversation. If you're using the same
> > >session (i.e., same browser window/tab, etc.) then there shouldn't
> > be
> > >any issues.
> >
> > I'm using the same browser and tab, I'm just testing application by
> > using links in it (without logging out).
> >
> > >I'd focus first on your implementation logic. You can also check the
> > >session ID to make sure they're the same session--if they're not,
> > >something's wrong.
> >
> > O.K. I'll check this.
> >
> > --
> > Thx, Milan
> >
> > Dave Newton wrote: There is only one session
> > per conversation. If you're using the same
> > session (i.e., same browser window/tab, etc.) then there shouldn't be
> > any issues.
> >
> > I'd focus first on your implementation logic. You can also check the
> > session ID to make sure they're the same session--if they're not,
> > something's wrong.
> >
> > Dave
> >
> > --- Milan Milanovic wrote:
> >
> > > Should my action class implement SessionAware ?
> > >
> > > Milan Milanovic wrote: Hi Martin,
> > >
> > > thank you.
> > >
> > > My action package extends="struts-default", does this mean when I
> > > call
> > > ActionContext.getContext().getSession() that I doesn't have access
> > to
> > > session ?
> > >
> > > It seems to me that every creates a new session for my action
> > class,
> > > and at least two methods doesn't have access to the same session.
> > How
> > > can I manage to share my variable through multiple jsp pages for
> > one
> > > action class using the users session ?
> > >
> > > --
> > > Thx, Milan
> > >
> > > Martin wrote: Hello Milan-
> > >
> > > You can accomplish creation of HttpSession via
> > > CreateSessionInterceptor
> > >
> >
> http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/CreateSessionInterceptor.html
> > >
> > > (session parameters are available via a map which is is available
> > > via)
> > > ActionContext.getContext().getSession()
> > >
> > > If you would be amenable to using a IOC container I would look at
> > > implementing Springs SessionContextAutowiringInterceptor
> > >
> >
> http://www.opensymphony.com/webwork/api/com/opensymphony/webwork/spring/interceptor/SessionContextAutowiringInterceptor.html
> > >
> > > HTH
> > > Martin
> > >
> > > ----- Original Message -----
> > > From: "Milan Milanovic"
> > > To: "Struts Users Mailing List"
> > > Sent: Wednesday, May 28, 2008 11:08 AM
> > > Subject: Re: [Struts 2] Session scope
> > >
> > >
> > > > It seems that every request have its own scope ?!
> > > >
> > > > Milan Milanovic wrote: Hi,
> > > >
> > > > I have one action class and two pages. When first page is called,
> > > in its
> > > > execute method I remove my session variable, like this:
> > > >
> > > > ServletActionContext.getContext().getSession().remove("fruits");
> > > >
> > > > and then when form from the first jsp page is submitted user
> > enter
> > > details
> > > > in the second form and there I save those changed to session,
> > too:
> > > >
> > > > ServletActionContext.getContext().getSession().put("fruits",
> > > fruits);
> > > >
> > > > Of course, I first check if there is already fruits in session. I
> > > do this
> > > > because some maybe want to go to first page to change something
> > and
> > > then
> > > > to go again to the second page to continue entering other info.
> > > But, when
> > > > I exit both page an execute method is called (with above session
> > > remove
> > > > method), and my second page is called fruits from session are
> > read
> > > again -
> > > > they are not removed ?
> > > >
> > > > --
> > > > Thx in advance, Milan Milanovic
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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)
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_186973.ezm (zipped)--- "McDowell, Paula" <Paula.McDowell@(protected):
> Thanks. I don't have any static variables. . . I'm assuming you are
> speaking of the contextRelative attribute on forwards? If not,
> please explain actions defined as Context-level.
I think he was asking if your actions have any member variables that
shouldn't be shared across requests/sessions/etc.
Dave

Attachment:
user_186975.ezm (zipped)
I have the following code:
<c:if test="${param.error == 'login'}">
<div
class="error">${sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message}</div>
</c:if>
It seems that param is a jstl specific property, so I'm wondering how to
access a url parameter using struts 2 and the <s:if test=""> syntax.
Thanks!
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_186976.ezm (zipped)--- Eric Martin <eric@(protected):
> I have the following code:
> <c:if test="${param.error == 'login'}">
> <div
>
class="error">${sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message}</div>
> </c:if>
>
> It seems that param is a jstl specific property, so I'm wondering how
> to access a url parameter using struts 2 and the <s:if test="">
> syntax.
http://struts.apache.org/2.x/docs/ognl.html
That said, why change it?
Dave

Attachment:
user_186978.ezm (zipped)Hi,
Try like this
<s:if test="#attr.error == 'login'}">
<div class="error">#session.SPRING_SECURITY_LAST_EXCEPTION.message</div>
</s:if>
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_186977.ezm (zipped)