You don't need to use encodeURL for includes or forwards. These are server side processes and the session has already been determined. The encodeURL tags the *next* client request with the data required to continue a session.

HTH,

Jon

Anson Zeall wrote:

Thanks a lot,

But......for example...if I have a jsp file..that includes another jsp
file in it.....how can I write it with encodeURL? Doesn't seem to work..

E.g.
<%@ include file="<%= response.encodeURL("header_status_register.jsp")
%>" %> doesn't work

Anson

-----Original Message-----
From: Christopher Williams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2003 5:55 PM
To: Tomcat Users List
Subject: Re: The function for response.encodeURL....me still not sure


As I said, the URL-rewriting is done by the container to allow you to use HTTP sessions when the user of your site has disabled cookies and it does this by appending ";jessionid=blah-blah-blah" to end of your URLs prior to the query string ("?blah=stuff&jabber=yakka-yakka..."). This is all in the servlet spec. However, you need to give the container the opportunity to do so and for this you need to use the encodeURL methods of HttpServletResponse.

Think about your JSPs.  Currently (presumably) you have links like the
following:
    <a href="some_link.jsp">Some link</a>

To enable session tracking without cookies, all you need to do is:
    <a href="<%= response.encodeURL("some_link.jsp") %>">Some link</a>

Likewise, whenever the logic of your page indicates that a redirect is
required, instead of calling:
    response.sendRedirect("some_link.jsp");
you call
    response.sendRedirect(response.encodeRedirectURL("some_link.jsp"));

Check out the J2EE tutorial for examples:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets11.html#63281

Chris.





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



Reply via email to