You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ramita Gambhir <ra...@gmail.com> on 2007/10/03 12:35:06 UTC

Session scoped ActionForm causing strange behaviour

Hi all,
 
I integrated Struts with Ajax using DWR. For that I had to put the
ActionForm in session scope.
Now I am facing a strange problem.

When I change some values in the form, they are saved(marshalled) properly
at the backend(an XML file). But in the JSP, it shows old values only.
I suspect this is happening because of session scoped ActionForm. Its taking
values from the existing Form object in the session. And its not
unmarshalling it everytime.
So what can I do to resolve this problem? Any pointers??
What's the basic difference between request-scoped and session-scoped form
objects?

Immediate help is needed...

Thanks a lot in advance.

Regards,
Ramita
-- 
View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13016312
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Session scoped ActionForm causing strange behaviour

Posted by Ramita Gambhir <ra...@gmail.com>.
Hi,

Thanks a lot for your replies :-) 

I found the solution to my problem. It was a case of missing "name"
parameter in the <html:select>.
I had used <html:select property="xyz">. It was showing the values from
previous form object.

Thanks a bunch! 
Regards,
Ramita



Antonio Petrelli-3 wrote:
> 
> 2007/10/3, Ramita Gambhir <ra...@gmail.com>:
>>
>> Is there any way I can refresh the values in the Form object?
> 
> 
> 
> What do you exactly mean with "refresh"?
> 
> 
> I read
>> somewhere reset() function is not called in session scoped forms. If I
>> call
>> reset(), can it help?
> 
> 
> Probably, but you have to override it to clear your properties in your
> ActionForm class.
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13042125
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Session scoped ActionForm causing strange behaviour

Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/3, Ramita Gambhir <ra...@gmail.com>:
>
> Is there any way I can refresh the values in the Form object?



What do you exactly mean with "refresh"?


I read
> somewhere reset() function is not called in session scoped forms. If I
> call
> reset(), can it help?


Probably, but you have to override it to clear your properties in your
ActionForm class.

Antonio

Re: Session scoped ActionForm causing strange behaviour

Posted by Ramita Gambhir <ra...@gmail.com>.
Hi Antonio,

Thanks a lot for the reply :-)

I need to put the form into session to make it work with DWR(I had some
requirement). This part I cannot change.

Is there any way I can refresh the values in the Form object? I read
somewhere reset() function is not called in session scoped forms. If I call
reset(), can it help?

Thanks,
Ramita


Antonio Petrelli-3 wrote:
> 
> 2007/10/3, Ramita Gambhir <ra...@gmail.com>:
>>
>> I integrated Struts with Ajax using DWR. For that I had to put the
>> ActionForm in session scope.
> 
> 
> 
> Why do you need to put it into session?
> 
> Now I am facing a strange problem.
>>
>> When I change some values in the form, they are saved(marshalled)
>> properly
>> at the backend(an XML file). But in the JSP, it shows old values only.
>> I suspect this is happening because of session scoped ActionForm.
> 
> 
> Your suspect is right! The action form is persisted across the requests.
> 
> 
> What's the basic difference between request-scoped and session-scoped form
>> objects?
> 
> 
> 
> That session scoped form objects are stored in session, so you don't clear
> it after the end of the request.
> 
> Immediate help is needed...
> 
> 
> You get immediate help only if you pay someone... :-)
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13016861
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Session scoped ActionForm causing strange behaviour

Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/3, Ramita Gambhir <ra...@gmail.com>:
>
> I integrated Struts with Ajax using DWR. For that I had to put the
> ActionForm in session scope.



Why do you need to put it into session?

Now I am facing a strange problem.
>
> When I change some values in the form, they are saved(marshalled) properly
> at the backend(an XML file). But in the JSP, it shows old values only.
> I suspect this is happening because of session scoped ActionForm.


Your suspect is right! The action form is persisted across the requests.


What's the basic difference between request-scoped and session-scoped form
> objects?



That session scoped form objects are stored in session, so you don't clear
it after the end of the request.

Immediate help is needed...


You get immediate help only if you pay someone... :-)

Antonio