This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes How can i add url parameter to my forward from the action ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How can i add url parameter to my forward from the action ?" Watch "How can i add url parameter to my forward from the action ?" New topic
Author

How can i add url parameter to my forward from the action ?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
How can i add url parameter to my forward from the action ?
i should add a parameter and its value to the forward , from the action
problem is that i can not use session attribute or request arrtibute , just parameter
Im trying to use google Search tag http://google-taglib.sourceforge.net/
for my project , but problem is that i should just search inside my own domain :

in google search : it is like this :
q=what i want to search + site:www.mydomain.com
now i should add this parameter to the result jsp
the forward should be something like :
results.jsp?q=.......

can some one provide some suggestion pleas ?
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
Try this one

ActionForward forward = mapping.findForward("SUCCESS"); // SUCCESS is the strong defined in the struts configuration xml file.

if (forward == null)
{
return null;
}
String name = forward.getName();
String path = forward.getPath();
String parameter = "valuePassed"
boolean redirect = forward.getRedirect();
boolean contextRelative = forward.getContextRelative();

path += "?param1=" + parameter ;

return new ActionForward(name, path, redirect, contextRelative);
}
raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you . it is even my very bad problem which i had from before and i solve it very badly
goign back to some url while i tried to include it into another jsp file.
but now i just forward to that url

thank you.
 
 
subject: How can i add url parameter to my forward from the action ?