struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nielsen, Jim" <>
Subject RE: can't redirect out of the context
Date Wed, 25 Jun 2003 20:06:04 GMT

I ran into a need to do the same.

1. I believe you need Struts 1.1.
2. In my Action I have code that gets a destination url from a properties
file based on parameters.

// determine the destination based on the params in the LinkParams
// create a LinkMapper based on Div key

	LinkMapper myLinkMapper =
	String newDest = myLinkMapper.findRedirectUrl(aLinkReq);

	ActionForward af;
	if (newDest == null)
		af = mapping.findForward("DefaultDest");
		newDest = af.getPath();
		af = new ActionForward(newDest, true);
	// do a redirect to the destination
	return af;

My action in the struts-config.xml file looks like this.
    <!-- Do Redirect! -->
    <action    path      = "/Redirector"
               type      = "redirector.actions.RedirectorAction"
               name      = "RedirectorForm"
               scope     = "request"
               validate  = "false"
     	<forward name="DefaultDest" path=""
contextRelative="true" redirect="true" />

Hope it helps.

Jim Nielsen
phone: (810) 234-4025 (8-394)
AOL IM: JimRNielsenEDS
jabber id:

4100 S. Saginaw., MC:  485-303-321
Flint, MI  48557

-----Original Message-----
From: Afshartous, Nick []
Sent: Wednesday, June 25, 2003 2:04 PM
To: ''
Subject: can't redirect out of the context


I'm trying to have an Action redirect to yahoo using the lines
below. However, the servlet context is getting prepended
and the error is

   The requested resource (/acme/ is not available.

Setting contextRelative did not make a difference.

Thanks for any suggestions.  

 ActionForward forward = new RedirectingActionForward("");


 return forward;

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message