• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

After page loads, clear form bean value

 
roseline ruba
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form bean property.
I want to set empty value to the form bean after the page loads.

Any ideas?

Thanks in Advance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
roseline ruba
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.
But i'm using struts v1.
And i'm using layout.
So Please let me know how to do to this?

Thanks in advance
[ October 11, 2007: Message edited by: roseline ruba ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the JSTL c:set tag regardless of what other framework you are using. All you have to do is include the JSTL jar files and taglib declarations. I've shown you a way to do what you asked that will work. There are undoubtedly others.
 
roseline ruba
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if the property is ArrayList instead of String?
[ October 12, 2007: Message edited by: roseline ruba ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to reinitialize the list as in:

The best place to do that is in the reset method in your ActionForm. When you override the reset method, make sure the signature matches exactly that found in the Struts Javadoc.
 
roseline ruba
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your suggestion.

But my requirement is ,,
I have a list.
I want to get some values in the list from Action to JSP Page.
And when submitting the JSP, I want to pass new values in the list.
So I want to clear the list in JSP.

How can I do this?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by roseline ruba:
And when submitting the JSP, I want to pass new values in the list.
So I want to clear the list in JSP.

Roseline,

Passing new values to the list is not the same as clearing it. It would have been better if you had been clear about what you wanted to do from the beginning.

In this case, you will need to use indexed properties. To find out more about how to do this and to see a working example of the same, please see question 6 of this forum's FAQ.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic