This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Help on struts 2 bean usage Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Help on struts 2 bean usage
 
Similar Threads
Struts 2: why object is removed from the ValueStack?
Setting Value of html:text from a Bean
<jsp:include> and <jsp:useBean>
Can getters/setters be seperated from the ActionSupport class with a bean?
accessing <s:param> values in action