You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Asim Ghosh <as...@yahoo.co.uk> on 2004/06/18 13:05:42 UTC

problem with jsession id

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
 
<html:form action="admin.login.do;jsessionid=1101010654575" >
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 

RE: problem with jsession id

Posted by Andrew Hill <an...@gridnode.com>.
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 [mailto:dhruv_psc@yahoo.com]
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"
styleClass="button">Login</html:link>

How can i get rid of this thing

--Dhruv




Nicolas De Loof <ni...@capgemini.com> 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.

Nico.




> 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: "recipient@capgemini.com".

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: problem with jsession id

Posted by Daniel Perry <d....@netcase.co.uk>.
There is no need for you to use a taglib to render a link! The easiest
solution:

<a href="javascript:login();" class="button">Login</a>

> -----Original Message-----
> From: Dhruv Trivedi [mailto:dhruv_psc@yahoo.com]
> Sent: 18 June 2004 12: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"
> styleClass="button">Login</html:link>
>
> How can i get rid of this thing
>
> --Dhruv
>
>
>
>
> Nicolas De Loof <ni...@capgemini.com> 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.
>
> Nico.
>
>
>
>
> > 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: "recipient@capgemini.com".
>
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem with jsession id

Posted by Dhruv Trivedi <dh...@yahoo.com>.
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" styleClass="button">Login</html:link>

How can i get rid of this thing

--Dhruv


 

Nicolas De Loof <ni...@capgemini.com> 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.

Nico.




> 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: "recipient@capgemini.com".

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Re: problem with jsession id

Posted by Nicolas De Loof <ni...@capgemini.com>.
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.

Nico.




> 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
>
> <html:form action="admin.login.do;jsessionid=1101010654575" >
> 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: "recipient@capgemini.com".

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: problem with jsession id

Posted by Daniel Perry <d....@netcase.co.uk>.
That would be jsp adding the session id.  Not really a problem, so do you
really need to get rid of it?

I think it wont appear on further pages, becuase it will use a session
cookie (if i understand correctly, the first time it adds that just in case
session cookie doesn't work).

You should be able to turn off sessions somewhere, or you might be able to
tell it not to use anything other than cookies.  Not sure where thought, so
check JSP docs and or the container config to try for info.

Daniel.

> -----Original Message-----
> From: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk]
> Sent: 18 June 2004 12:06
> To: user@struts.apache.org
> Subject: problem with jsession id
>
>
> 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
>
> <html:form action="admin.login.do;jsessionid=1101010654575" >
> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org