struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egetchell <eric.getch...@distributedlogic.com>
Subject Struts 2: Action chaining behaving differently when validations fire
Date Mon, 05 May 2008 16:36:27 GMT

All,

I’m experiencing some interesting behavior when forwarding via action
chaining as a result of input validation.

In a non-error situation, action chaining works as expected – that is the
service method of the chained action is invoked as expected.  However, what
I am noticing is that when a validation error fires, the service method of
the chained action is bypassed entirely – instead the request is forwarded
to the result defined in the struts mapping of the action class.

To test this, I created two simple classes, testA and testB.  testA is used
to build the data to display a page and testB is used to collect the data
from the page.   

The Struts configuration is the following (Spring is being used as the
object factory):

<action name="testA" class="testA" method="display">
  <result name="input">testA.jsp</result>
</action>

<action name="testB" class="testB" method="submit">
  <result name="input" type="chain">
    testA
    display
  </result>
</action>

The display method of testA always returns INPUT.
The submit method of B always returns INPUT.

This allows me to test the same result of INPUT – one invoked via an input
validation error and the second during normal application flow.

When testB is invoked and no validation errors fire (INPUT is returned from
the service method), I see the following methods invoked on the back-end:
TestB.submit
TestA.display

However, when testB is invoked and validation errors fire, TestA.display is
not invoked.  Instead, the input mapping is read and the request is
forwarded to testA.jsp per the mapping.

Ideally, I’d like the testA action to fire when validation fires.

Eric Getchell | Sr. Technologist

Distributed Logic Corporation
600 Unicorn Park
Woburn, MA 01801


-- 
View this message in context: http://www.nabble.com/Struts-2%3A-Action-chaining-behaving-differently-when-validations-fire-tp17065631p17065631.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message