This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clear Form Bean Values