Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display form class values on success page

 
syd kahn
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should fall into the Really Stupid question section - all the books I have tell you how to manage a series of FORMS in struts. and the examples I see simpley forward to a final success page with geneic success text.

All I want to do is display some values that were gathered on stuts form to the user - like his name and what he registered for. I suspect that a [code]<bean:[code] tag is invloved - but how do i tell the success jsp page which bean - or does just "know"...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On your input form, you tell struts which action to call using a tag like this: <html:form action="/myAction">

In your struts-config file, you tell struts which form bean to populate like this:
<form-bean name="myForm" type="com.mycompany.MyFormBean"></form-bean>
<action name="myForm" path="/myAction" scope="request" type="com.mycompany.MyAction"></action>

If you do this, struts populates MyFormBean for you when the form is submitted. If you want to display values from this bean in the next page, just put the instance of MyFormBean in some scope (request, session, or application) with the setAttribute() method and use the <bean:write> tag in the JSP to display its properties. The <bean:write> tag looks for the bean in any scope.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic