Session tracking with Struts

Hi,

I would like some informations about the session with Struts.

First of all, how the URL rewriting works. In the documentation I read "tag link automaticaly apply URL rewriting", but how does it work ? To track a session Struts uses URL rewriting or the cookies ?

In the struts example, we can see the rewriting URL with the string ;jsessionid=269C0BABDF64D34D66AFE4156201358D behind the resource asked. But how the ; character is managed with Struts since the parameters in the URL have to be separate with & character ? Besides, when I reload the page, the jsessionid disappear...

In the Struts example, several pages use

<html:link page="/myResource>

<bean:message key="myKey"/>

</html:link>

whereas there is only the index page that rewrite the URL. So how the session can be tracked if there are some links without session identifier in the URL ?

I tried to use the same method provide in the Struts example but it doesn't work. When I use

<html:link page="/myResource>

<bean:message key="myKey"/>

</html:link>

There is never session identifer in my URL...

Thanks for any information.

[1224 byte] By [JulienVa] at [2007-9-27 8:46:45]
# 1

JulienV, don't worry :)

Everything works fine. Yes, struts should append jsessionid to ur url, but not always. It does so only when you are using a GET method. Otherwise the sessionid goes unvisible. Generally it uses cookies, but if those are disabled, struts automatically switches to URL-rewriting technique.

This was a common approach yet in earlier JSP/Servlet developments, but now struts makes your life easier :))

Best regards,

Andrew

mr_dronskia at 2007-7-8 17:17:46 > top of Java-index,Other Topics,Patterns & OO Design...