Thanks for the comment.
The problem is not that I'm losing the validation errors. I'm keeping
those across the redirect by using a modified interceptor stack with
the STORE interceptor. So, that's cool.
The problem is that *because* the errors are being preserved across
the redirect (I think it's because), the validation/workflow
interceptor for the action that is the destination of the "input"
result type (back to 'Action1' that is) is ALSO picking up on the
presence of those validation errors and ALSO looking for a place to go
for an 'input' return type. It looks like this:
Action1 -> search screen.jsp -> submit form -> Action2 -> (validation
error found; input says 'Action1") -> Action1 -> (validation error
found; looks for 'input' result type) -> Exception since there is no
mapping for 'input' on Action1
I wish it would just stop here:
Action1 -> search screen.jsp -> submit form -> Action2 -> (validation
error found; input says 'Action1") -> Action1
I've worked on this some more and found a possible solution by further
modifying the interceptor stack for Action1:
<action name="Action1" method="execute" class="Action1">
<interceptor-ref name="defaultStack">
<param name="validation.excludeMethods">execute</param>
<param name="workflow.excludeMethods">execute</param>
</interceptor-ref>
<result name="success">searchQuery.jsp</result>
</action>
Now, the execute method of Action1 is excluded from validation. The
propogating errors from Action2 don't cause a problem for Action1. I
don't know if I need to exclude the execute method from BOTH
validation and workflow interceptors, but it works. Any thoughts on
that?
I do have a second problem, though: the validation errors are
remaining across multiple invocations of Action2. Even a successful
(validated) form submission is not erasing the OLD validation errors.
I need a way to remove the old errors after they are displayed.
Anyone have any ideas on that too?
Thanks as always,
Kevin
On Jan 2, 2008, at Wednesday, January 2, 2008 - 4:35 PM, Laurie
Harper wrote:
Kevin Wade wrote:
Greetings. I've seen a number of posts about this issue -- or
related issues -- but no comprehensive solution. I'll try again
and be succinct:
I have an action (Action1) that prepares a search screen (i.e.
populates a drop-down box). The search screen/form calls Action2
but has a Action2-validation.xml file which specifies validation
rules. In my struts.xml file, the result type of "input" for
Action2 will redirect back to Action1 so that the search form is
properly prepared and displayed.
This isn't working as I would expect. The validation seems to work
fine but when the redirect to Action1 occurs on the result type of
"input"... Action1 is not running because it ALSO is trying to find
a result type of "input."
So... any ideas? I'm not sure why the "input" return type is
propagating from Action2 to Action1, but I gather that the presence
of the validation errors is triggering something in the
DefaultWorkflowInterceptor in Action1 when the re-direct back to it
occurs.
Any ideas how to make that not happen? How can I make validation
not run on Action1? Or, alternatively, make the Interceptor ignore
the validation errors after the redirect? I tried adding a
@SkipValidation annotation to the execute() method of Action1, but
that did nothing. Any ideas?
Kevin
Unless you've configured something to preserve them, the validation
errors should be getting lost on the redirect (which is, of course,
not what you want in this scenario but is the default behavior).
What interceptor stack are you using? How are you preserving user
input across the redirect?
I would suggest creating a minimal sample application demonstrating
the problem, then posting the relevant bits of code and
configuration for people to play with to diagnose what's happening.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]