struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad A Cupit" <b...@lsu.edu>
Subject chain interceptor
Date Tue, 12 Aug 2008 16:17:20 GMT
I have a question about the placement of the chain interceptor in the
defaultStack.

Take the following situation:
* preferredUserId is a form field submitted by the user. It is the user
id
  they want (if that user id is not already taken)
* Action1 has a setPreferredUserId() method but if the user id is
  taken, a new id is generated for them and returned in the
  getPreferredUserId() method
* Action1's result is a chain to Action2, which also has a
  setPreferredUserId() method

Action2.setPreferredUserId() will be called twice, once by the chain
interceptor and once by the params interceptor, but since the chain
interceptor is setup to run earlier in the stack than the params
interceptor, Action2 will have preferredUserId from the request, not the
value output from Action1.

Ok, I know this example is contrived, and I don't actually have code in
an app which uses this. I also know the benefits of Redirect After POST
vs action chaining and I agree that it's very odd for Action2 to have a
setter that also matches a request parameter.

However, it seems unusual for the params interceptor to 'take
precedence' (because it happens later in defaultStack). It seems that
you'd always want the value from Action1 rather than what's in the
request.

My question is: is there some reason why 'chain' appears where it does
in defaultStack? I'd like to move it later in the stack, after the
params interceptor, but is there a good reason not to do that?

Brad Cupit
Louisiana State University - UIS


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


Mime
View raw message