aspose file tools*
The moose likes Struts and the fly likes ending the session of a form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ending the session of a form?" Watch "ending the session of a form?" New topic
Author

ending the session of a form?

Sheetal Sachdev
Greenhorn

Joined: Mar 26, 2004
Posts: 6
Hi
I have a action class called questionAction and a form called questionForm. In the struts-config.xml file i have set the scope of the form to be 'session' as i use the same form across multiple jsp pages, and need to pass data around them.
I have a side navigation bar, when a user clicks a link on this bar, i would like to end the session of my questionForm, i.e. set all its values to null.
I know i can end the http session using...
HttpSession session = request.getSession();
session.invalidate();
...but this ends all the sessions.
How can I end the session of the questionForm, or clear all its values?
Thanks
Sheetal
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

explicitly call the reset method of the form
you may even get away with session.removeAttribute("questionForm"); but I've never tried it myself.
[ April 07, 2004: Message edited by: Marc Peabody ]

A good workman is known by his tools.
Sheetal Sachdev
Greenhorn

Joined: Mar 26, 2004
Posts: 6
Hi
<br/>
<p>I am aware of the reset method, but how do i call this from a different actionClass, that doesnt have access to questionForm that i want to reset?</p>
thanks
Sheetal Sachdev
Greenhorn

Joined: Mar 26, 2004
Posts: 6
hiya
thanks very much the session.removeAttribute("questionForm"); worked great!
thanks again
Sheetal
 
 
subject: ending the session of a form?
 
Similar Threads
Counting tokens allows us to test whether a postfix expression is wellformed. Anyone seen it before?
data persistence across many JSP's
changes are not being reflected in the javascript file
Form values when forwarding to an action
Setting and removing session attributes - is this the right way to do this?