permaculture playing cards*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display form class values on success page" Watch "display form class values on success page" New topic
Author

display form class values on success page

syd kahn
Greenhorn

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.


Merrill
Consultant, Sima Solutions
 
 
subject: display form class values on success page
 
Similar Threads
null action form in pre processing action
sending map object to success view
Display all Users Detail on JSP page when we Loged in through ADMIN
Newbie question on RELOAD or REDIRECT?
How to display values from database to html page using servlet