You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kruse, Matt" <MK...@aquent.com> on 2003/05/13 20:45:24 UTC
RE: RE: Accessing an action directly with req parameter and from
a fo rward?
> That sounds like a good approach.
Well, I've done the proof of concept for you, so you can be SURE it works :)
> When you say ParameterActionForward, are you referring to this:
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg
> 14217.html
Yes. I've adapted it for my purposes a bit, but that's the concept.
Also, in my case, I added a method called
addForwardParameter(request, key, value)
to my BaseAction. That stores an arraylist of parameters in a request
attribute.
At the end of my BaseAction, I grab the forward that has been given. If
parameters exist, I create a new ParameterActionForward, add on the
parameters, and return it. Easy as pie.
So my screen action code looks something like:
if (command.equals(COMMAND_SAVE)) {
try {
save(request, bean, connection);
setForward(request, FORWARD_SAVE);
addForwardParameter(request, RECORD_ID, bean.getID());
addMessage(request, "save.success");
} catch (MyBoException e) {
setForward(request, FORWARD_SAVEFAILURE);
}
}
> P.S.Are you the old AWStats (I think that was the name) Matt Kruse?
MKStats, and yup, that was me. Long ago :)
Matt