struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <>
Subject RE: problem with jsession id
Date Fri, 18 Jun 2004 11:45:49 GMT
Well for a start you should not use html:link for javascript links! (only
for real links!)
html:link's (primary) purpose is to ensure that the jsessionid is added to a
href url if cookies are disabled (or on the first page). Obviously that
functionality is hardly applicable for a javascript link where the href isnt
a url.

-----Original Message-----
From: Dhruv Trivedi []
Sent: Friday, 18 June 2004 19:45
To: Struts Users Mailing List
Subject: Re: problem with jsession id

Hi Niko and all other guys,

is there any way in struts to avoid this URL rewriting.

Actually jsessionid is also appended with the link with which i am
submitting the form.
have a look on code:
Original code is:
<html:link href="javascript:login()" styleClass="button">Login</html:link>

But when i run application(first time):
<html:link href="javascript:login();jsessionid;7568975745"

How can i get rid of this thing


Nicolas De Loof <> wrote:

On first request, a session is created. Tomcat (or any other servlet
container) wan use two mecanism to handle sessions
: cookies or URL rewriting (add a ";jsessionid=...").

Preference is for cookies, because it doesn't need to change URLs in pages,
but on first request, Tomcat has no way to
know if the browser accepts cookies, so it needs to rewrite URLs AND put a
setCookie header.

If next request have cookie, URL rewriting is not mandatory anymore.

URL rewriting is done when encoding URL using response.encodeUrl(). Struts
is compliant with J2EE and calls this method
in jsp tags for every URL it has to render.

If you don't want such URL to be shown in user browser, you should use a
redirect on your first action.


> hello guys,
> when i open the login form of my struts application, for the very first
time a jession id is appended with the
value of action attribute
> example
> above value is shown in the source code of the displayed page.
> can any one tell me why it happens and how can i solve this problem.
> Asim Ghosh
> ---------------------------------
> ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself

Our name has changed. Please update your address book to the following
format: "".

This message contains information that may be privileged or confidential and
is the property of the Capgemini Group. It is intended only for the person
to whom it is addressed. If you are not the intended recipient, you are not
authorized to read, print, retain, copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error,
please notify the sender immediately and delete all copies of this message.

To unsubscribe, e-mail:
For additional commands, e-mail:

Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message