You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tarun Sainanee <ta...@delhi.tcs.co.in> on 2002/07/25 14:00:25 UTC

jsession id get appended to the javascript function

Hi,

I am using weblogic6.1 sp2 and have also implememted struts framework.
About the problem that i am facing, here goes:

I have the following two links in my jsp file
Link 1: Is implemented using the struts tlds
<html:link href="javascript:check_click()"><html:img 
src="/ModBoa/images/clear.gif" border="0"/></html:link>

Link 2: Is implemented using conventional html
<a href="javascript:check_click()"><img src="/ModBoa/images/clear.gif" 
border="0"></a>


These two links call the same javascript function ie. they point to the 
same functionality.

Now when i click on link 2, the javascript function is called as expected 
and the function is carried out.
However, if i had clicked on link 1 instead of clicking on link 2, i get a 
javascript error.

The error occurs because a jessionid is appended to the name of the 
javascript function.
So in effect, when i take my mouse over link 2, the browser status bar 
shows just the name of the javascript function.
But when i place my mouse over link 1, the browser status bar shows the 
jsession id appended to the name of the javascript function

And this is a problem that occurs that only whenever a new session is 
created (one of the many ways to create a new session is by opening a new 
browser instance).

Anyone has any clue to what i am talking about?

Thnx in advance.

Tarun Sainanee

Re: jsession id get appended to the javascript function

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 25 Jul 2002, Tarun Sainanee wrote:

> Date: Thu, 25 Jul 2002 17:30:25 +0530
> From: Tarun Sainanee <ta...@delhi.tcs.co.in>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: jsession id get appended to the javascript function
>
> Hi,
>
> I am using weblogic6.1 sp2 and have also implememted struts framework.
> About the problem that i am facing, here goes:
>
> I have the following two links in my jsp file
> Link 1: Is implemented using the struts tlds
> <html:link href="javascript:check_click()"><html:img
> src="/ModBoa/images/clear.gif" border="0"/></html:link>
>
> Link 2: Is implemented using conventional html
> <a href="javascript:check_click()"><img src="/ModBoa/images/clear.gif"
> border="0"></a>
>
>
> These two links call the same javascript function ie. they point to the
> same functionality.
>
> Now when i click on link 2, the javascript function is called as expected
> and the function is carried out.
> However, if i had clicked on link 1 instead of clicking on link 2, i get a
> javascript error.
>
> The error occurs because a jessionid is appended to the name of the
> javascript function.
> So in effect, when i take my mouse over link 2, the browser status bar
> shows just the name of the javascript function.
> But when i place my mouse over link 1, the browser status bar shows the
> jsession id appended to the name of the javascript function
>
> And this is a problem that occurs that only whenever a new session is
> created (one of the many ways to create a new session is by opening a new
> browser instance).
>
> Anyone has any clue to what i am talking about?
>

The <html:link> tag automatically calls response.encodeURL on the URLs it
generates, on the assumption that it is a link into the same web
application, and therefore needs a session id added (if cookies are
disabled, or if this is the first response in a new session).

One would think that WebLogic would recognize from the "javascript:"
scheme that this is not an http-style link and not perform the rewriting,
but apparently it doesn't.  You're probably better off using the Link 2
format for a link like this.

> Thnx in advance.
>
> Tarun Sainanee
>

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>