You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michael Edge <mi...@db.com> on 2002/09/05 15:03:18 UTC

XSP Redirect in Cocoon 2

Hi All

It seems to me that the following code will not work in Cocoon 2. I believe it works in Cocoon 1, but for some reason the request and response objects available within XSP for Cocoon 2 are not HttpServletRequest and HttpServletResponse objects, but rather some cocoon equivalents, org.apache.cocoon.environment.Response and org.apache.cocoon.environment.Request. Unfortunately these new classes do not include the sendRedirect method. Any ideas how I would do this? I need to construct a URL in my code and redirect to that URL.

  <xsp:logic>
    String url = URLEncoder.encode(url + whatever + parameters);
    response.sendRedirect(url);
  </xsp:logic>

Thanks

Michael



--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSP Redirect in Cocoon 2

Posted by Nicola Ken Barozzi <ni...@apache.org>.
http://outerthought.net/wiki/Wiki.jsp?page=Redirecting



-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSP Redirect in Cocoon 2

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Michael Edge wrote:
> Hi All
> 
> It seems to me that the following code will not work in Cocoon 2. 
 > I believe it works in Cocoon 1, but for some reason the request
 > and response objects available within XSP for Cocoon 2 are not
 > HttpServletRequest and HttpServletResponse objects, but rather
 > some cocoon equivalents, org.apache.cocoon.environment.Response
 > and org.apache.cocoon.environment.Request. Unfortunately these
 > new classes do not include the sendRedirect method. Any ideas
 > how I would do this? I need to construct a URL in my code
 > and redirect to that URL.
> 
>   <xsp:logic>
>     String url = URLEncoder.encode(url + whatever + parameters);
>     response.sendRedirect(url);
>   </xsp:logic>
> 
> Thanks

Don't use XSPs for flow control, use the sitemap.

Add an Action that does this and redirect. You can write Actions using 
XSPs BTW.

Better still, use the action to return the url and then do a <redirect> 
in the sitemap; it makes your action more reusable.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>