aspose file tools*
The moose likes Struts and the fly likes Help on struts 2 bean usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help on struts 2 bean usage" Watch "Help on struts 2 bean usage" New topic
Author

Help on struts 2 bean usage

Luca Zitto
Greenhorn

Joined: Feb 08, 2010
Posts: 23
Probably I am doing something really stupid, but can anyone please explain?
I have a jsp and, at the top, before the html tag I populate a bean as follows:
<s:bean name="lucaluke.MyBean" var="myBean">
<s:param name="model"><s:property value="codePassed" /></s:param> <!-- this is just a code passed from previous action -->
</s:bean>
Let's say in html I print the value from myBean.model, this is also fine.

then on the page I use the value from the bean, I have a form which calls an action and all is fine.
Problem is when the validation in the action fails (validate() method...) in this case I correctly addFieldError and go to the jsp set as input in struts.xml
the error is correctly displayed but...
As in input I have defined to remain on the same jsp as before, I would expect myBean to be still valid, am I correct in this assumption?
should myBean and / or codePassed as defined above still be valid or not? because apparently, they are not and I end up with a more or less blank page...
What am I doing wrong? Something really stupid I guess?
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help on struts 2 bean usage