File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes reset actionForm values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "reset actionForm values" Watch "reset actionForm values" New topic

reset actionForm values

Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
I have a set of functionality that must have a scope of session. What I want to do is get rid of any values that were entered in some of the text fields when I come back to a particular page. Since the scope is session, if I entered in a Social Sec number in a text box, if I submit the page and then come back, the SSN is still being displayed and I want it to be gone. Any suggestions on the correct way to go about doing this?
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
If you are using Struts MVC model, then you should not be directly accessing a JSP page from the browser. It should go through some sort of action or forward.
The reasoning would then be you would simply reset the values of the form as part of the action before it forwards to your JSP.
Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
And How exactly you would call reset() method and clear the field values on that page ??
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

add value="" to your struts html:text tags and watch values magically vanish

A good workman is known by his tools.
I agree. Here's the link:
subject: reset actionForm values
It's not a secret anymore!