File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes display form class values on success page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display form class values on success page" Watch "display form class values on success page" New topic

display form class values on success page

syd kahn

Joined: Aug 23, 2005
Posts: 12
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

Joined: Feb 15, 2005
Posts: 4864
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: display form class values on success page
It's not a secret anymore!