Sorry, my bad... it's not setURL, it's setPath. It's actually a method
of ForwardConfig, which ActionForward extends. Look in the third table
down in the link you sent, the section labeled "Methods inherited from
class org.apache.struts.config.ForwardConfig".
That's what I get for going from memory ;)
Frank
Zarar Siddiqi wrote:
Where do you see the af.setURL(String) method in the ActionForward class?
http://struts.apache.org/api/org/apache/struts/action/ActionForward.html
I had a similar problem where dynamic values needed to be passed in via
an ActionForward but I wasn't able to find something as simple as you
suggest. I had to store the values in session scope (because the
ActionForward had redirect=true) and then clean up the session in my
receiving code.
So you store the values that you are passing in session scope for a
quick millisecond while you forward and then clean up once you're in the
called method.
Zarar
----- Original Message ----- From: "Frank W. Zammetti"
<[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Cc: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Tuesday, June 14, 2005 9:27 AM
Subject: Re: Sending dynamic parameters to a forward
You can, IIRC, append a query string to the URL returned by your
forward... off the top of my head, it would look something like
this... in
Action 1:
String param1Val = "someValue1";
String param2Val = "someValue2";
String queryString = "?param1=" + param1Val + "¶m2 = " + param2Val;
ActionForward af = new
ActionForward(mapping.findForward("ForwardToAction2"));
af.setURL(af.getURL() + queryString);
return af;
You'll probably want to encode the parameter values, I'd suggest Commons
Codec for that.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Tue, June 14, 2005 7:52 am, tarek.nabil said:
Hi Everyone,
I have an action (Action1) which when completed successfully, forwards
to another action (Action2). I need to be able to send dyanamic
parameters to Action2. I thought about putting the parameters as request
attributes, but the problem here is that Action2 can be called directly
using a link from some pages and this case, the parameters will be send
as request parameters rather than attributes.
I can write code to look in the request attributes and if not found, it
can check the request parameters, but I was hoping there's another way
to do it. I thought about setting the redirect attribute to true on this
forward but I still wouldn't know how to append parameters with dynamic
values to the forward while forwarding to it from Action1.
Any ideas?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]