This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: reset actionForm values
Similar Threads
Problem with persisting text box values in JSP
how to handle session scope and request scope???
Moving a bean from request to session context
Carry values between page submit
back button issue