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.
Hi, I am using Struts 1.1 in this topic. I have a very simple page with only 1 input field for age. I assign it to DynaActionForm with request scope. Then I create a simple Action class that does nothing but forwarding to the landing page, which is a jsp page. At landing page, I want to display different messages based on the age field in Formbean. At landing page, I am trying to get the value of age field from the FormBean and assign it to a java variable so I can perform logic in jsp page, meaning using <% %> scriplet. Here is the pseudocode of landing page ######################################## <% Get Age field and assign to java variable. If (Age < 10) { %> Hello Kid <% }else if (Age between 10 - 20){ %> Hello Dude <% }else{ %> Hello Folks <% } %> ########################################## Can someone give me some clue? Thanks
########################################
sandy gupta
Ranch Hand
Joined: Jan 30, 2001
Posts: 228
posted
0
make the action scope session S
Adios
sandy gupta
Ranch Hand
Joined: Jan 30, 2001
Posts: 228
posted
0
and yeah you should use the struts bean tag to get the property value of the bean members. <bean:write property="age"/> will print the age value on the page for you. OR You could get the form from the scope that u set it in session/request using the name attribute that u specify in the struts config and then call the getters and setters. The solution above is cleaner. S
SoonAnn Lim
Ranch Hand
Joined: Jun 21, 2001
Posts: 155
posted
0
I am not very clear about this. <bean:write property="age" /> will output to the page. How can I assign this value in jsp scriptlet? <% int age = <bean:write property="age"/> ; %> Something like that?