Now, I can understand how pulling
path="login.do?someparm=hello" in a forward shouldn't work (even stepping
through the code, I still can't figure out how it was working before
Theres no problem slipping query params into a forward url like that. Its a
standard technique. All my apps depend on it. Look elsewhere for your bug
for it lyeth not in the forwarded params.
btw: redirecting to another action is not action chaining. Its only chaining
if you do it on the server side (non-redirecting), and its only evil as you
can get (a lot of) unanticipated side-effects from a second pass through the
request processor (such as form repopulation)
-Original Message-
From: Thompson, David [mailto:[EMAIL PROTECTED]
Sent: Thursday, 18 September 2003 03:26
To: '[EMAIL PROTECTED]'
Subject: Chained Actions (why so bad?), forwards vs. redirects, and
Tiles
I'm still not seeing why 'chained' actions are so bad. On our current
project, we want a user who has just signed up to go ahead and be logged-in
all in the same step, and forwarded straight to the logged-in homepage.
There are 2 actions, and using 1.1b3 with Tiles, the following struts-config
worked just fine:
We even figured out that you could specify the next 'link' of the chain with
it's own request parameters, ala path="login.do?someparm=hello". Note that
it _forwarded_ to the next action (same request object, so we could pass
data as attributes), and re-triggering the dispatcher was a-ok. So then we
switched to 1.1final, and noticed this doesn't work any more ("Cannot get
request dispatcher for path..."). Now, I can understand how pulling
path="login.do?someparm=hello" in a forward shouldn't work (even stepping
through the code, I still can't figure out how it was working before), but
for a number of circumstances, I still want to be able to _forward_ to other
actions.
Why is that so bad? I'm not entirely seeing how it's breaking the MVC
pattern. The intent of an action is to perform a discreet activity so
you're not duplicating code everywhere, so to get 2 or more to execute on
one request seems completely within reason. I realize there's no way to
change request parameters, so yes, I'd be using request attributes to pass
data between actions, so I suppose that's the whole riff over chained
actions? the 'bad' practice of using request attributes? Would it be bad
if I didn't need to pass anything to the next action? I'd argue using a
redirect (