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

Struts 2 validation chaining

anand kumarblr

Joined: Oct 27, 2006
Posts: 27
I am trying to use actionchaining in struts2 and am stuck. Any help would
be really appreciated.

Scenario - I have a page that shows a list of records and also has a form
to add a new record. When user clicks on add I call addAction and chain it
to list action to go back to list page again showing the newly added

My struts.xml looks something like this ->

<action name="add" class="com.test.AddAction">
<result name="success" type="chain">
<result name="input" type="chain">list</result>
<action name="list" class="com.test.ListAction">
<result name="success">/proj/list.jsp</result>

I have 1 issues/questions -
a) My validation does not work if I chainactions. If I don't enter
anything in add textbox and click on Add then I get a html 404 error. If I
route to list.jsp instead of chaning to list action then I see validation
messages. But I really need to show list on that page as well. So I can
not forward to the jsp.

I would really appreciate some feedback/help here.
Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70
I too have the same issue. i am looking for a answer

I hope that we have done mistake in interceptors
I agree. Here's the link:
subject: Struts 2 validation chaining
It's not a secret anymore!