struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: ActionForward with runtime parameter?
Date Thu, 08 Jul 2004 12:16:17 GMT
Yep. Pretty much so. Its what we all do. :-)

Those who do it often tend to bang up some utility code to reduce the typing
but the end result is pretty much the same. You may wish to use the other
constructor for ActionForward and preserve the redirect flag. ie:

ActionForward fwd = mapping.findForward("success");
String path = fwd.getPath()+"?id="+glform.getGroep();
return new ActionForward(path, fwd.getRedirect());

-----Original Message-----
From: Twan Kogels [mailto:twan@twansoft.com]
Sent: Thursday, 8 July 2004 20:20
To: user@struts.apache.org
Subject: ActionForward with runtime parameter?


Hello people,

I've started my first project with struts. It's working fine, clean and
quick. But i have a question regarding actionforwards and parameters to the
path.

I have a form; when the user submits the form i forward the user to another
page. This page requires one parameter (?id=x) to function. Now i use a
code like:

return new
ActionForward(mapping.findForward("success").getPath()+"?id="+glform.getGroe
p());

to forward and add a parameter. The forward "success" contains the url to
the page without parameters (/page.do). I then append the "id=" parameter
and create a new ActionForward.

The value of the id= parameter is only known when the user submits the
form. So i cannot put the id parameter in the struts-config.xml file.

Is the above code the best and cleanest way to do the thing i want to do?

Cheers,
Twan Kogels



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


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


Mime
View raw message