• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help on struts 2 bean usage

 
Luca Zitto
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic