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 Clear Form Bean 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 "Clear Form Bean Values" Watch "Clear Form Bean Values" New topic
Author

Clear Form Bean Values

Kalaiselvan Selvamani
Ranch Hand

Joined: Sep 10, 2001
Posts: 32
Hai All
I want to clear formbean values. But i couldnt able to clear the values. The request values are not cleared.
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope())) {
request.removeAttribute(mapping.getAttribute());
} else {
HttpSession session = request.getSession();
session.removeAttribute(mapping.getAttribute());
}
}
This only cleared the request attribute not request parameter. How can we clear our request parameter values. If get the request.getParameterNames() i got all the values setted before the screen. Before moving to another screen i have to clear all the formbean values.
Thanx in Advance
Kalaiselvan.S
Lakshmanan NS
Greenhorn

Joined: Apr 02, 2003
Posts: 20
When you submit a form from a browser, the underlying HTML framework is that all the variables in the form goes into the request as parameters. Struts takes these values and set them into the corresponding Form and put the form into either request or session scope. So, struts naturally provides ways to clear the Form objects as well as the attritutes in the form. But, clearing the parameters in the request itself it not available under the servlet framework and it has nothing to do with struts. The request will get cleared automatically when the control goes back to the browser.
Lakshman
 
Consider Paul's rocket mass heater.
 
subject: Clear Form Bean Values
 
Similar Threads
Still not working - DynaValidatorActionForm and checkboxes
not cleared
cleared with 94%
mapping.getAttribute gives null pointer exception
Cleared SCWCD