wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 validation chaining" Watch "Struts 2 validation chaining" New topic
Author

Struts 2 validation chaining

anand kumarblr
Greenhorn

Joined: Oct 27, 2006
Posts: 27
Hi
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
record.

My struts.xml looks something like this ->

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

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

http://www.coderanch.com/t/475156/Struts/Applicati...works/Struts-Chain-Result-Type
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2 validation chaining
 
Similar Threads
Pass bean from one action to another in strust2
struts 2 and messages !!
No Result defined for action in struts2.samples.actions.ReportsAction and result success
Interceptor messes up action class in Struts2
can any one explain how the data is comming in Action directly pls