tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luiz Borba <bo...@diga-me.com.br>
Subject Re: Redirect and cookies
Date Wed, 24 May 2000 13:09:40 GMT
Hi,


I had the same problem... Use <jsp:forward page="...">, not sendRedirect ! Ok ?


Luiz


Em qua, 24 mai 2000, you wrote:
> Hi,
> 
>    switching from jserv 1.1 to tomcat 3.1 I found that the following snippet
> of code doesn't work any more:
> 
> String name = "foo";
> String value = "admin";
> if (name != null && name.length() > 0) {
>     Cookie c = new Cookie(name, value);
>     c.setMaxAge(4*60*60);
>     c.setVersion(0);
>     c.setPath("/");
>     response.addCookie(c);
>     response.sendRedirect(response.encodeRedirectURL("http://www.mysite.com"));
> }
> 
> The problem is that if I try to set a cookie and then call 
> response.sendRedirect, the cookie is not set at all. 
> If I comment out the last line of code, the cookie is set. 
> Is this a tomcat problem ? With jserv 1.1 this code worked fine.
> 
> Thanks very much,
> 		Mirko Manea
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
-- 
Luiz Borba
Diga-me.com


Mime
View raw message