Another thought is that you could still use a <forward> element to define an 
external resource:

<global-forwards>
  <forward name="external.yahoo" path="http://www.yahoo.com"/>
  <forward name="external.sun" path="http://www.sun.com"/>
</global-forwards>

Then, in an Action:

ActionForward yahoo = mapping.findForward("external.yahoo");
response.sendRedirect(response.encodeRedirectURL(yahoo.getPath()));

Never tried it, but seems like it should work. Just understand that those 
forwards can't be used by the standard Struts machinery.

Quoting Brian Hickey <[EMAIL PROTECTED]>:

> Wolfgang,
> 
> Redirect outside of an app can be done a number of ways.
> 
> One suggestion:
> 
> Map your redirect to a class that creates the forwardURL.
> Put the forwardURL into request scope.
> Create a JSP that does nothing but the redirect. Map to it in
> struts-config.
> use the jsp:usebean and <meta http_equiv> tag to perform the external
> redirect.
> 
> The advantage of this method is logging which can be done in the class and
> you have no context other than what you specify in the <meta http-equiv>
> tag.
> 
> 
> Brian
> 
> 
> 
> ----- Original Message -----
> From: "Kris Schneider" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, November 18, 2002 11:58 AM
> Subject: Re: How to Redirect ???
> 
> 
> > That's not what the contextRelative attribute means. Here's the snippet
> from
> > the 1.1 DTD:
> >
> > contextRelative  Set this to "true" if, in a modular application, the
> path
> >                  attribute starts with a slash "/" and should be
> considered
> >                  relative to the entire web application rather than the
> module.
> >                  Since Struts 1.1.
> >                  [false]
> >
> > The redirect attribute only determines if RequestDispatcher.forward or
> > HttpServletResponse.sendRedirect is used. In either case, the path
> attribute is
> > always either module-relative or context-relative.
> >
> > I think you'll have to use something like
> HttpServletResponse.sendRedirect
> > directly in your Action to redirect outside your app's context.
> >
> > Quoting "Trieu, Danny" <[EMAIL PROTECTED]>:
> >
> > > Isn't there is a contextrelative attribute in the <forward/> tag where
> you
> > > can set to 'true'?
> > >
> > > -----Original Message-----
> > > From: wolfgang [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, November 18, 2002 8:15 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: How to Redirect ???
> > >
> > >
> > > Hi there,
> > >
> > > I wanna make users redirect(not forward) to http://www.yahoo.com , but
> > > cannot make it...
> > >
> > > I added the following elements in the struts-config.xml
> > >
> > > <global-forwards>
> > >   <forward name="finish" path="http://www.yahoo.com"; redirect="true" />
> > > </global-forwards>
> > >
> > > and the following code in the execute method of the Action class.
> > >
> > > return mapping.findForward("finish");
> > >
> > > but It doesn't work.
> > > Struts attempts to make users redirect to the
> > > "/test_webapp/http://www.yahoo.com"; where /test_webapp is the name of
> my
> > > web
> > > application.
> > >
> > > How can I make it ??
> > >
> > > Thanks in advance.
> > >
> > > wolfgang-
> > >
> > >
> > > --
> > > wolfgang <[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > --
> > Kris Schneider <mailto:[EMAIL PROTECTED]>
> > D.O.Tech       <http://www.dotech.com/>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to