This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Populating jsp page when validation fails - problem with s:action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating jsp page when validation fails - problem with s:action" Watch "Populating jsp page when validation fails - problem with s:action" New topic
Author

Populating jsp page when validation fails - problem with s:action

Miguel Almeida
Greenhorn

Joined: Mar 12, 2010
Posts: 9
The general idea is (as per https://cwiki.apache.org/WW/how-do-we-repopulate-controls-when-validation-fails.html) to have the following:
1) jsp with a list of items and a "add item" form
2) when validation fails, the list of items should still populate

The method: Add a <s:action name="xxx" executeResult="true"/> to the jsp, that should execute even when the validation fails and sends the action to INPUT
The problem: When helloWorld's validation fails (see below), Action xxx is redirecting to input, and not to SUCCESS, as expected.

Does anyone know why this happen?

A simple /jsp/index.jsp would be (where helloWorld's method is annotated with @RequiredStringValidator):


The action configuration (I've explicitly defined interceptor-ref here to ensure I'm using the default stack) :


Expected: If either the name or date are not filled, the validation fails and sends to input. The contents of centreList.jsp should be shown, however, because that action should be independent. I've even annotated the loadTrialCentres with @SkipValidation
Actual: The contents of xxx.jsp are shown.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating jsp page when validation fails - problem with s:action
 
Similar Threads
Struts 2 JCaptchaforStruts 2 issue
struts 2 validation and prevent double submit
Struts 2 - passing request parameters to jsp from an Interceptor
can't include another .xml file in struts.xml
struts 2 validator problem