This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Redisplaying a page after validation due to validation errors? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Redisplaying a page after validation due to validation errors?" Watch "Redisplaying a page after validation due to validation errors?" New topic
Author

Redisplaying a page after validation due to validation errors?

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109
hi,

I have the following entry in my Struts-config.xml

<action path="/TestAction"
roles="20"
scope="session"
type="myActionClass"
name="myActionForm"
input="/page1.jsp"
parameter="action">
<forward name="prepare"
path="/page1.jsp" />
<forward name="Create"
path="/OtherAction?action=prepare" />
<forward name="Perform"
path="/Page2.jsp" />
<forward name="Edit"
path="/page2.jsp" />
</action>

My action tag has multiple forward tags leading to multiple JSP. All JSP are associated with a single form bean. In my form bean i had overridden the validate() method. If validation fails, the page specified in the "input" attribute of the <action> tag is redisplayed.

In my case i had given first jsp page (page1.jsp) in the "input" attribute. If validation fails in any of the pages it redisplays the first jsp page. Even if validation fails in the fourth or fifth jsp page it redisplays the first jsp page. Is there any way we can rediplay the current page with validation errors?

Regards,
Ajay.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
There are plenty of different ways to create wizard pages. For some ideas here are some mappings that I created for some wizard like pages. As far as your question, note that when the user submits a page, the action ProcessUserWizard is used. If validation fails it sends the user to another action, RefreshUserWizard. The RefreshUserWizard knows based on the valid of the "step" property (which is part of the form and a hidden field on the jsp) which page should be shown.


- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redisplaying a page after validation due to validation errors?