You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Sayre <ri...@gmail.com> on 2007/05/08 15:33:09 UTC

request.getParameter is returning the wrong value

 My web application generates a list of links for a user to click on.

The URL looks like this:  showCa.jsp?id=2345

The showCa.jsp page uses the id to populate a form on the page.

The problem I am have is when a user clicks the link showCa.jsp?id=2345

The request.getParameter("id") is returning the wrong id!

I have never seen behavior like this before. This page has been
working in production for a long time. I reproduced the error, and it
only seems to be happening when there are multiple users logged in.
The wrong id that appears belongs to another user. On the showCa.jsp
page I printed out the query string and the value of id and got this:

queryString : ?id=2345
id : 2226



Has anyone seen anything like this before? I have been coding JSP for
3 years now and I have never seen behavior like this. This is
occurring on Tomcat 4.1/ JDK 1.4

I greatly appreciate any suggestions that you may have.

Thank you

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
On 5/8/07, Christopher Schultz <ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Richard,
>
> Richard Sayre wrote:
> > I started to look in the _jspService and I noticed the the variable
> > which I assign the request.getParameter("id") to is not in that
> > method.
>
> Note that JSP authors these days almost never actually call
> request.getParameter()... they use a tag library which helps cut down on
> the confusion such as this.
>
> > The variable is called 'theID'.  One thing I noticed about it is it
> > is declared like this
> >
> > !String theID;
>
> That's invalid Java syntax. Can you give us a few more characters around
> that declaration? For instance:
>
> <%! String theID; %>
>
> Creates a member of the class, which will be shared across all
> invocations of the JSP. If that's the case, then you've found your problem.
>
> > I have never seen this before.  Does this make the variable static?
>
> Not static. Just class-level instead of being declared as a local within
> the body of the service method (which is what you really want).
>
> > I 3 years I have never encountered it [ <%! ... %> syntax].
>
> That's because it's almost never done. It only really makes sense when
> you want to declare a method for use within the class. Declaring class
> members this way usually leads to tears.
>
> > Hopefully removing it will solve my problem.
>
> You just want to remove the !, actually. The declaration is probably
> required.
>
> - -chris
>


The ! operator was the cause of my problem.  I would like to thank
everyone for their help and insight.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard,

Richard Sayre wrote:
> I started to look in the _jspService and I noticed the the variable 
> which I assign the request.getParameter("id") to is not in that 
> method.

Note that JSP authors these days almost never actually call
request.getParameter()... they use a tag library which helps cut down on
the confusion such as this.

> The variable is called 'theID'.  One thing I noticed about it is it
> is declared like this
> 
> !String theID;

That's invalid Java syntax. Can you give us a few more characters around
that declaration? For instance:

<%! String theID; %>

Creates a member of the class, which will be shared across all
invocations of the JSP. If that's the case, then you've found your problem.

> I have never seen this before.  Does this make the variable static?

Not static. Just class-level instead of being declared as a local within
the body of the service method (which is what you really want).

> I 3 years I have never encountered it [ <%! ... %> syntax].

That's because it's almost never done. It only really makes sense when
you want to declare a method for use within the class. Declaring class
members this way usually leads to tears.

> Hopefully removing it will solve my problem.

You just want to remove the !, actually. The declaration is probably
required.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGQJtf9CaO5/Lv0PARAoDjAJwMSfhA/CKiQ7YU/fJQsnRlGUKxygCgscwH
l5ihkVI7oPQdS5m/hyPyJAo=
=rcqu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Jason Polites <ja...@gmail.com>.
too late.. looks like Mr Schultz has the correct answer.

On 5/9/07, Jason Polites <ja...@gmail.com> wrote:
>
> That's really strange.  If that's in the generated .java file then I'm
> amazed it actually compiles.  It's syntactically incorrect.  Are you sure
> it's not just the editor you are using to view the file interpreting an
> unknown character?  (I doubt it).
>
> As a first step I'd delete the compiled JSP and have jasper recompile it.
>
> Are you using scriptlets (<%%>) in your JSP?  or just tags like JSTL?
> Maybe you are declaring some strange variable yourself (again.. unlikely).
>
> The only other thing I can suggest is to rename the variable in both the
> calling page and the JSP.  There is no reason why this should be any
> different, but it's worth a try.
>
>
>  On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> >
> > I know you don't want to hear this but I'm not sure about what I can
> > release due to company restrictions.  I wouldn't want to get fired for
> > posting out source.  I will ask the right people if I can post a few
> > pages of the source but it may take a while for them to get back to
> > me.
> >
> > I haven't found any docs but I think the ! operator makes the variable
> > a member of the class, not the _jspService method.
> >
> > When I search for the declaration of 'theId' it was declared as a
> > member of the showCa_jsp class with no modifier (default).  I am
> > assuming that tomcat will create once instance of this class, and use
> > it when ever that page is requested.  The _jspService variables will
> > be different for each instance since they are local to that method but
> > the member variables will be shared.
> >
> > I can't find the doc on the operator for JSP.  I think this is the
> > problem but I want to be sure that it is before I remove it from the
> > code.
> >
> > On 5/8/07, David Delbecq <de...@oma.be> wrote:
> > > Give us the .jsp and the jasper generated .java file, it will be
> > faster
> > > to solve :)
> > >
> > > En l'instant précis du 08/05/07 17:22, Richard Sayre s'exprimait en
> > ces
> > > termes:
> > > > Also,  If you have any information about declaring a variable with !
> > > > I would like to know.  I am having trouble finding any on google and
> >
> > > > my JSP book.
> > > >
> > > > On 5/8/07, Richard Sayre <ri...@gmail.com> wrote:
> > > >> Yes the right values are passed.  Th eonly one of those variable
> > that
> > > >> really efects the data on the page is vId, which is hard coded into
> > > >> the <a href="..">
> > > >>
> > > >> I started to look in the _jspService and I noticed the the variable
> >
> > > >> which I assign the request.getParameter("id") to is not in that
> > > >> method.
> > > >>
> > > >> The variable is called 'theID'.  One thing I noticed about it is it
> > is
> > > >> declared like this
> > > >>
> > > >> !String theID;
> > > >>
> > > >> I have never seen this before.  Does this make the variable static?
> > > >> If so then it is obvious why this is happening
> > > >>
> > > >> I am going to look up this ! operator to see what it does. I 3
> > years I
> > > >> have never encountered it.  Hopefully removing it will solve my
> > > >> problem.  I will keep you updated.
> > > >>
> > > >>
> > > >> On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
> > > >> > First, I'd just make sure you are passing the right value from
> > the
> > > >> form.
> > > >> > alert() the (editFlag=" + document.theForm.editFlag.value  +
> > > >> "&activeTab=" +
> > > >> > document.theForm.activeTab.value + "&id=" + vId;) string before
> > you
> > > >> do the
> > > >> > location.href to be sure.
> > > >> >
> > > >> > Given that you are saying it works until multiple users access...
> > > >> it sounds
> > > >> > like there is some variables in the wrong scope.  Recall that a
> > JSP is
> > > >> > compiled to a normal servlet by the container, and servlets are
> > shared
> > > >> > resources.  so.. if you are putting the value into a "shared"
> > area
> > > >> within
> > > >> > the jsp/servlet, it would make sense that you get strange results
> > with
> > > >> > multiple users.
> > > >> >
> > > >> > All local (page scope) variables *should* be defined within the
> > > >> "service"
> > > >> > method of the compiled servlet, and hence shouldn't cause a
> > > >> problem.. so I
> > > >> > can only think you are placing the variable in some sort of
> > static
> > > >> > location?
> > > >> >
> > > >> > If you say that the query string shows the correct location..
> > then
> > > >> things
> > > >> > are really strange.  Does the address in the browser show the
> > correct
> > > >> > location/url?
> > > >> >
> > > >> >
> > > >> >
> > > >> > On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> > > >> > >
> > > >> > > Sorry about that.  When I copied and pasted I missed the
> > function
> > > >> name
> > > >> > > and I typed it in manually.  I double checked and the function
> > > >> name is
> > > >> > > spelled correctly.  This code works normally until multiple
> > users
> > > >> > > login.
> > > >> > >
> > > >> > > I pass these values the JSP page when the following JavaScript
> > > >> executes:
> > > >> > >
> > > >> > > top.location.href="showCa.jsp?editFlag=" +
> > > >> > > document.theForm.editFlag.value  + "&activeTab=" +
> > > >> > > document.theForm.activeTab.value + "&id=" + vId;
> > > >> > >
> > > >> > >
> > > >> > > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> > > >> > > > you are calling js function named 'showCa'
> > > >> > > > but your javascript function name is 'showCap'
> > > >> > > > When/Where do you actually pass these values to servlet?
> > > >> > > >
> > > >> > > > M--
> > > >> > > > This email message and any files transmitted with it contain
> > > >> > > confidential
> > > >> > > > information intended only for the person(s) to whom this
> > email
> > > >> message
> > > >> > > is
> > > >> > > > addressed.  If you have received this email message in error,
> > > >> please
> > > >> > > notify
> > > >> > > > the sender immediately by telephone or email and destroy the
> > > >> original
> > > >> > > > message without making a copy.  Thank you.
> > > >> > > >
> > > >> > > > ----- Original Message -----
> > > >> > > > From: "Richard Sayre" < richardsayre@gmail.com>
> > > >> > > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > > >> > > > Sent: Tuesday, May 08, 2007 9:55 AM
> > > >> > > > Subject: Re: request.getParameter is returning the wrong
> > value
> > > >> > > >
> > > >> > > >
> > > >> > > > > On 5/8/07, Caldarale, Charles R <
> > Chuck.Caldarale@unisys.com>
> > > >> wrote:
> > > >> > > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com ]
> > > >> > > > >> > Subject: request.getParameter is returning the wrong
> > value
> > > >> > > > >> >
> > > >> > > > >> > The problem I am have is when a user clicks the link
> > > >> > > > >> > showCa.jsp?id=2345
> > > >> > > > >> >
> > > >> > > > >> > The request.getParameter("id") is returning the wrong
> > id!
> > > >> > > > >>
> > > >> > > > >> This is usually caused by application code storing some
> > > >> value in the
> > > >> > > > >> wrong scope, or erroneous use of static
> > variables.  Storing a
> > > >> > > > >> request-specific item in the session or servlet objects is
> > > >> one such
> > > >> > > > >> example.
> > > >> > > > >>
> > > >> > > > >>  - Chuck
> > > >> > > > >
> > > >> > > > > I store a 'UserSession' object in Tomcats session but it
> > does
> > > >> not
> > > >> > > > > contain a variable called "id".  This is the only
> > > >> variable/object that
> > > >> > > > > I am storing in that scope.  Everything else is using the
> > 'page'
> > > >> > > > > scope.
> > > >> > > > >
> > > >> > > > > I am passing the "id" parameter through the URL (HTTP GET
> > > >> Method).
> > > >> > > > >
> > > >> > > > > The Generated HTML looks like this:
> > > >> > > > >
> > > >> > > > > <a class="row" href="javascript:showCa(1818);">1818
> > > >> 2007/04/13</a>
> > > >> > > > >
> > > >> > > > > The showCa function:
> > > >> > > > >
> > > >> > > > > function showCap( vId ) {
> > > >> > > > >
> > > >> > > > >
> > > >> > > > >    top.location.href="showCa.jsp?editFlag=" +
> > > >> > > > > document.theForm.editFlag.value  + "&activeTab=" +
> > > >> > > > > document.theForm.activeTab.value + "&id=" + vId;
> > > >> > > > >
> > > >> > > > >
> > > >> > > > > }
> > > >> > > > >
> > > >> > > > > The JavaScript function redirects the browser.
> > > >> > > > >
> > > >> > > > > On the showCa page the URL in the browser has the right
> > ID.  The
> > > >> > > > > request.getQueryString(); returns the proper query string
> > but
> > > >> the
> > > >> > > > > request.getParameter("id") does not return the id that is
> > in
> > > >> the URL
> > > >> > > > > or QueryString
> > > >> > > > >
> > > >> > > > >
> > > >>
> > ---------------------------------------------------------------------
> > > >> > > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > >> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >> > > > > For additional commands, e-mail:
> > users-help@tomcat.apache.org
> > > >> > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > > >
> > > >>
> > ---------------------------------------------------------------------
> > > >> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > >> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >> > > >
> > > >> > > >
> > > >> > >
> > > >> > >
> > > >>
> > ---------------------------------------------------------------------
> > > >> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > >> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

Re: request.getParameter is returning the wrong value

Posted by Jason Polites <ja...@gmail.com>.
That's really strange.  If that's in the generated .java file then I'm
amazed it actually compiles.  It's syntactically incorrect.  Are you sure
it's not just the editor you are using to view the file interpreting an
unknown character?  (I doubt it).

As a first step I'd delete the compiled JSP and have jasper recompile it.

Are you using scriptlets (<%%>) in your JSP?  or just tags like JSTL?  Maybe
you are declaring some strange variable yourself (again.. unlikely).

The only other thing I can suggest is to rename the variable in both the
calling page and the JSP.  There is no reason why this should be any
different, but it's worth a try.


On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
>
> I know you don't want to hear this but I'm not sure about what I can
> release due to company restrictions.  I wouldn't want to get fired for
> posting out source.  I will ask the right people if I can post a few
> pages of the source but it may take a while for them to get back to
> me.
>
> I haven't found any docs but I think the ! operator makes the variable
> a member of the class, not the _jspService method.
>
> When I search for the declaration of 'theId' it was declared as a
> member of the showCa_jsp class with no modifier (default).  I am
> assuming that tomcat will create once instance of this class, and use
> it when ever that page is requested.  The _jspService variables will
> be different for each instance since they are local to that method but
> the member variables will be shared.
>
> I can't find the doc on the operator for JSP.  I think this is the
> problem but I want to be sure that it is before I remove it from the
> code.
>
> On 5/8/07, David Delbecq <de...@oma.be> wrote:
> > Give us the .jsp and the jasper generated .java file, it will be faster
> > to solve :)
> >
> > En l'instant précis du 08/05/07 17:22, Richard Sayre s'exprimait en ces
> > termes:
> > > Also,  If you have any information about declaring a variable with !
> > > I would like to know.  I am having trouble finding any on google and
> > > my JSP book.
> > >
> > > On 5/8/07, Richard Sayre <ri...@gmail.com> wrote:
> > >> Yes the right values are passed.  Th eonly one of those variable that
> > >> really efects the data on the page is vId, which is hard coded into
> > >> the <a href="..">
> > >>
> > >> I started to look in the _jspService and I noticed the the variable
> > >> which I assign the request.getParameter("id") to is not in that
> > >> method.
> > >>
> > >> The variable is called 'theID'.  One thing I noticed about it is it
> is
> > >> declared like this
> > >>
> > >> !String theID;
> > >>
> > >> I have never seen this before.  Does this make the variable static?
> > >> If so then it is obvious why this is happening
> > >>
> > >> I am going to look up this ! operator to see what it does. I 3 years
> I
> > >> have never encountered it.  Hopefully removing it will solve my
> > >> problem.  I will keep you updated.
> > >>
> > >>
> > >> On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
> > >> > First, I'd just make sure you are passing the right value from the
> > >> form.
> > >> > alert() the (editFlag=" + document.theForm.editFlag.value  +
> > >> "&activeTab=" +
> > >> > document.theForm.activeTab.value + "&id=" + vId;) string before you
> > >> do the
> > >> > location.href to be sure.
> > >> >
> > >> > Given that you are saying it works until multiple users access...
> > >> it sounds
> > >> > like there is some variables in the wrong scope.  Recall that a JSP
> is
> > >> > compiled to a normal servlet by the container, and servlets are
> shared
> > >> > resources.  so.. if you are putting the value into a "shared" area
> > >> within
> > >> > the jsp/servlet, it would make sense that you get strange results
> with
> > >> > multiple users.
> > >> >
> > >> > All local (page scope) variables *should* be defined within the
> > >> "service"
> > >> > method of the compiled servlet, and hence shouldn't cause a
> > >> problem.. so I
> > >> > can only think you are placing the variable in some sort of static
> > >> > location?
> > >> >
> > >> > If you say that the query string shows the correct location.. then
> > >> things
> > >> > are really strange.  Does the address in the browser show the
> correct
> > >> > location/url?
> > >> >
> > >> >
> > >> >
> > >> > On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> > >> > >
> > >> > > Sorry about that.  When I copied and pasted I missed the function
> > >> name
> > >> > > and I typed it in manually.  I double checked and the function
> > >> name is
> > >> > > spelled correctly.  This code works normally until multiple users
> > >> > > login.
> > >> > >
> > >> > > I pass these values the JSP page when the following JavaScript
> > >> executes:
> > >> > >
> > >> > > top.location.href="showCa.jsp?editFlag=" +
> > >> > > document.theForm.editFlag.value  + "&activeTab=" +
> > >> > > document.theForm.activeTab.value + "&id=" + vId;
> > >> > >
> > >> > >
> > >> > > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> > >> > > > you are calling js function named 'showCa'
> > >> > > > but your javascript function name is 'showCap'
> > >> > > > When/Where do you actually pass these values to servlet?
> > >> > > >
> > >> > > > M--
> > >> > > > This email message and any files transmitted with it contain
> > >> > > confidential
> > >> > > > information intended only for the person(s) to whom this email
> > >> message
> > >> > > is
> > >> > > > addressed.  If you have received this email message in error,
> > >> please
> > >> > > notify
> > >> > > > the sender immediately by telephone or email and destroy the
> > >> original
> > >> > > > message without making a copy.  Thank you.
> > >> > > >
> > >> > > > ----- Original Message -----
> > >> > > > From: "Richard Sayre" <ri...@gmail.com>
> > >> > > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > >> > > > Sent: Tuesday, May 08, 2007 9:55 AM
> > >> > > > Subject: Re: request.getParameter is returning the wrong value
> > >> > > >
> > >> > > >
> > >> > > > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com>
> > >> wrote:
> > >> > > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> > >> > > > >> > Subject: request.getParameter is returning the wrong value
> > >> > > > >> >
> > >> > > > >> > The problem I am have is when a user clicks the link
> > >> > > > >> > showCa.jsp?id=2345
> > >> > > > >> >
> > >> > > > >> > The request.getParameter("id") is returning the wrong id!
> > >> > > > >>
> > >> > > > >> This is usually caused by application code storing some
> > >> value in the
> > >> > > > >> wrong scope, or erroneous use of static variables.  Storing
> a
> > >> > > > >> request-specific item in the session or servlet objects is
> > >> one such
> > >> > > > >> example.
> > >> > > > >>
> > >> > > > >>  - Chuck
> > >> > > > >
> > >> > > > > I store a 'UserSession' object in Tomcats session but it does
> > >> not
> > >> > > > > contain a variable called "id".  This is the only
> > >> variable/object that
> > >> > > > > I am storing in that scope.  Everything else is using the
> 'page'
> > >> > > > > scope.
> > >> > > > >
> > >> > > > > I am passing the "id" parameter through the URL (HTTP GET
> > >> Method).
> > >> > > > >
> > >> > > > > The Generated HTML looks like this:
> > >> > > > >
> > >> > > > > <a class="row" href="javascript:showCa(1818);">1818
> > >> 2007/04/13</a>
> > >> > > > >
> > >> > > > > The showCa function:
> > >> > > > >
> > >> > > > > function showCap( vId ) {
> > >> > > > >
> > >> > > > >
> > >> > > > >    top.location.href="showCa.jsp?editFlag=" +
> > >> > > > > document.theForm.editFlag.value  + "&activeTab=" +
> > >> > > > > document.theForm.activeTab.value + "&id=" + vId;
> > >> > > > >
> > >> > > > >
> > >> > > > > }
> > >> > > > >
> > >> > > > > The JavaScript function redirects the browser.
> > >> > > > >
> > >> > > > > On the showCa page the URL in the browser has the right
> ID.  The
> > >> > > > > request.getQueryString(); returns the proper query string but
> > >> the
> > >> > > > > request.getParameter("id") does not return the id that is in
> > >> the URL
> > >> > > > > or QueryString
> > >> > > > >
> > >> > > > >
> > >> ---------------------------------------------------------------------
> > >> > > > > To start a new topic, e-mail: users@tomcat.apache.org
> > >> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >> > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> ---------------------------------------------------------------------
> > >> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > >> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >> > > >
> > >> > > >
> > >> > >
> > >> > >
> > >> ---------------------------------------------------------------------
> > >> > > To start a new topic, e-mail: users@tomcat.apache.org
> > >> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
I know you don't want to hear this but I'm not sure about what I can
release due to company restrictions.  I wouldn't want to get fired for
posting out source.  I will ask the right people if I can post a few
pages of the source but it may take a while for them to get back to
me.

I haven't found any docs but I think the ! operator makes the variable
a member of the class, not the _jspService method.

When I search for the declaration of 'theId' it was declared as a
member of the showCa_jsp class with no modifier (default).  I am
assuming that tomcat will create once instance of this class, and use
it when ever that page is requested.  The _jspService variables will
be different for each instance since they are local to that method but
the member variables will be shared.

I can't find the doc on the operator for JSP.  I think this is the
problem but I want to be sure that it is before I remove it from the
code.

On 5/8/07, David Delbecq <de...@oma.be> wrote:
> Give us the .jsp and the jasper generated .java file, it will be faster
> to solve :)
>
> En l'instant précis du 08/05/07 17:22, Richard Sayre s'exprimait en ces
> termes:
> > Also,  If you have any information about declaring a variable with !
> > I would like to know.  I am having trouble finding any on google and
> > my JSP book.
> >
> > On 5/8/07, Richard Sayre <ri...@gmail.com> wrote:
> >> Yes the right values are passed.  Th eonly one of those variable that
> >> really efects the data on the page is vId, which is hard coded into
> >> the <a href="..">
> >>
> >> I started to look in the _jspService and I noticed the the variable
> >> which I assign the request.getParameter("id") to is not in that
> >> method.
> >>
> >> The variable is called 'theID'.  One thing I noticed about it is it is
> >> declared like this
> >>
> >> !String theID;
> >>
> >> I have never seen this before.  Does this make the variable static?
> >> If so then it is obvious why this is happening
> >>
> >> I am going to look up this ! operator to see what it does. I 3 years I
> >> have never encountered it.  Hopefully removing it will solve my
> >> problem.  I will keep you updated.
> >>
> >>
> >> On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
> >> > First, I'd just make sure you are passing the right value from the
> >> form.
> >> > alert() the (editFlag=" + document.theForm.editFlag.value  +
> >> "&activeTab=" +
> >> > document.theForm.activeTab.value + "&id=" + vId;) string before you
> >> do the
> >> > location.href to be sure.
> >> >
> >> > Given that you are saying it works until multiple users access...
> >> it sounds
> >> > like there is some variables in the wrong scope.  Recall that a JSP is
> >> > compiled to a normal servlet by the container, and servlets are shared
> >> > resources.  so.. if you are putting the value into a "shared" area
> >> within
> >> > the jsp/servlet, it would make sense that you get strange results with
> >> > multiple users.
> >> >
> >> > All local (page scope) variables *should* be defined within the
> >> "service"
> >> > method of the compiled servlet, and hence shouldn't cause a
> >> problem.. so I
> >> > can only think you are placing the variable in some sort of static
> >> > location?
> >> >
> >> > If you say that the query string shows the correct location.. then
> >> things
> >> > are really strange.  Does the address in the browser show the correct
> >> > location/url?
> >> >
> >> >
> >> >
> >> > On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> >> > >
> >> > > Sorry about that.  When I copied and pasted I missed the function
> >> name
> >> > > and I typed it in manually.  I double checked and the function
> >> name is
> >> > > spelled correctly.  This code works normally until multiple users
> >> > > login.
> >> > >
> >> > > I pass these values the JSP page when the following JavaScript
> >> executes:
> >> > >
> >> > > top.location.href="showCa.jsp?editFlag=" +
> >> > > document.theForm.editFlag.value  + "&activeTab=" +
> >> > > document.theForm.activeTab.value + "&id=" + vId;
> >> > >
> >> > >
> >> > > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> >> > > > you are calling js function named 'showCa'
> >> > > > but your javascript function name is 'showCap'
> >> > > > When/Where do you actually pass these values to servlet?
> >> > > >
> >> > > > M--
> >> > > > This email message and any files transmitted with it contain
> >> > > confidential
> >> > > > information intended only for the person(s) to whom this email
> >> message
> >> > > is
> >> > > > addressed.  If you have received this email message in error,
> >> please
> >> > > notify
> >> > > > the sender immediately by telephone or email and destroy the
> >> original
> >> > > > message without making a copy.  Thank you.
> >> > > >
> >> > > > ----- Original Message -----
> >> > > > From: "Richard Sayre" <ri...@gmail.com>
> >> > > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> >> > > > Sent: Tuesday, May 08, 2007 9:55 AM
> >> > > > Subject: Re: request.getParameter is returning the wrong value
> >> > > >
> >> > > >
> >> > > > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com>
> >> wrote:
> >> > > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> >> > > > >> > Subject: request.getParameter is returning the wrong value
> >> > > > >> >
> >> > > > >> > The problem I am have is when a user clicks the link
> >> > > > >> > showCa.jsp?id=2345
> >> > > > >> >
> >> > > > >> > The request.getParameter("id") is returning the wrong id!
> >> > > > >>
> >> > > > >> This is usually caused by application code storing some
> >> value in the
> >> > > > >> wrong scope, or erroneous use of static variables.  Storing a
> >> > > > >> request-specific item in the session or servlet objects is
> >> one such
> >> > > > >> example.
> >> > > > >>
> >> > > > >>  - Chuck
> >> > > > >
> >> > > > > I store a 'UserSession' object in Tomcats session but it does
> >> not
> >> > > > > contain a variable called "id".  This is the only
> >> variable/object that
> >> > > > > I am storing in that scope.  Everything else is using the 'page'
> >> > > > > scope.
> >> > > > >
> >> > > > > I am passing the "id" parameter through the URL (HTTP GET
> >> Method).
> >> > > > >
> >> > > > > The Generated HTML looks like this:
> >> > > > >
> >> > > > > <a class="row" href="javascript:showCa(1818);">1818
> >> 2007/04/13</a>
> >> > > > >
> >> > > > > The showCa function:
> >> > > > >
> >> > > > > function showCap( vId ) {
> >> > > > >
> >> > > > >
> >> > > > >    top.location.href="showCa.jsp?editFlag=" +
> >> > > > > document.theForm.editFlag.value  + "&activeTab=" +
> >> > > > > document.theForm.activeTab.value + "&id=" + vId;
> >> > > > >
> >> > > > >
> >> > > > > }
> >> > > > >
> >> > > > > The JavaScript function redirects the browser.
> >> > > > >
> >> > > > > On the showCa page the URL in the browser has the right ID.  The
> >> > > > > request.getQueryString(); returns the proper query string but
> >> the
> >> > > > > request.getParameter("id") does not return the id that is in
> >> the URL
> >> > > > > or QueryString
> >> > > > >
> >> > > > >
> >> ---------------------------------------------------------------------
> >> > > > > To start a new topic, e-mail: users@tomcat.apache.org
> >> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> >> > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> ---------------------------------------------------------------------
> >> > > > To start a new topic, e-mail: users@tomcat.apache.org
> >> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> >> > > >
> >> > > >
> >> > >
> >> > >
> >> ---------------------------------------------------------------------
> >> > > To start a new topic, e-mail: users@tomcat.apache.org
> >> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > > For additional commands, e-mail: users-help@tomcat.apache.org
> >> > >
> >> > >
> >> >
> >>
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by David Delbecq <de...@oma.be>.
Give us the .jsp and the jasper generated .java file, it will be faster
to solve :)

En l'instant précis du 08/05/07 17:22, Richard Sayre s'exprimait en ces
termes:
> Also,  If you have any information about declaring a variable with !
> I would like to know.  I am having trouble finding any on google and
> my JSP book.
>
> On 5/8/07, Richard Sayre <ri...@gmail.com> wrote:
>> Yes the right values are passed.  Th eonly one of those variable that
>> really efects the data on the page is vId, which is hard coded into
>> the <a href="..">
>>
>> I started to look in the _jspService and I noticed the the variable
>> which I assign the request.getParameter("id") to is not in that
>> method.
>>
>> The variable is called 'theID'.  One thing I noticed about it is it is
>> declared like this
>>
>> !String theID;
>>
>> I have never seen this before.  Does this make the variable static?
>> If so then it is obvious why this is happening
>>
>> I am going to look up this ! operator to see what it does. I 3 years I
>> have never encountered it.  Hopefully removing it will solve my
>> problem.  I will keep you updated.
>>
>>
>> On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
>> > First, I'd just make sure you are passing the right value from the
>> form.
>> > alert() the (editFlag=" + document.theForm.editFlag.value  +
>> "&activeTab=" +
>> > document.theForm.activeTab.value + "&id=" + vId;) string before you
>> do the
>> > location.href to be sure.
>> >
>> > Given that you are saying it works until multiple users access...
>> it sounds
>> > like there is some variables in the wrong scope.  Recall that a JSP is
>> > compiled to a normal servlet by the container, and servlets are shared
>> > resources.  so.. if you are putting the value into a "shared" area
>> within
>> > the jsp/servlet, it would make sense that you get strange results with
>> > multiple users.
>> >
>> > All local (page scope) variables *should* be defined within the
>> "service"
>> > method of the compiled servlet, and hence shouldn't cause a
>> problem.. so I
>> > can only think you are placing the variable in some sort of static
>> > location?
>> >
>> > If you say that the query string shows the correct location.. then
>> things
>> > are really strange.  Does the address in the browser show the correct
>> > location/url?
>> >
>> >
>> >
>> > On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
>> > >
>> > > Sorry about that.  When I copied and pasted I missed the function
>> name
>> > > and I typed it in manually.  I double checked and the function
>> name is
>> > > spelled correctly.  This code works normally until multiple users
>> > > login.
>> > >
>> > > I pass these values the JSP page when the following JavaScript
>> executes:
>> > >
>> > > top.location.href="showCa.jsp?editFlag=" +
>> > > document.theForm.editFlag.value  + "&activeTab=" +
>> > > document.theForm.activeTab.value + "&id=" + vId;
>> > >
>> > >
>> > > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
>> > > > you are calling js function named 'showCa'
>> > > > but your javascript function name is 'showCap'
>> > > > When/Where do you actually pass these values to servlet?
>> > > >
>> > > > M--
>> > > > This email message and any files transmitted with it contain
>> > > confidential
>> > > > information intended only for the person(s) to whom this email
>> message
>> > > is
>> > > > addressed.  If you have received this email message in error,
>> please
>> > > notify
>> > > > the sender immediately by telephone or email and destroy the
>> original
>> > > > message without making a copy.  Thank you.
>> > > >
>> > > > ----- Original Message -----
>> > > > From: "Richard Sayre" <ri...@gmail.com>
>> > > > To: "Tomcat Users List" <us...@tomcat.apache.org>
>> > > > Sent: Tuesday, May 08, 2007 9:55 AM
>> > > > Subject: Re: request.getParameter is returning the wrong value
>> > > >
>> > > >
>> > > > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com>
>> wrote:
>> > > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
>> > > > >> > Subject: request.getParameter is returning the wrong value
>> > > > >> >
>> > > > >> > The problem I am have is when a user clicks the link
>> > > > >> > showCa.jsp?id=2345
>> > > > >> >
>> > > > >> > The request.getParameter("id") is returning the wrong id!
>> > > > >>
>> > > > >> This is usually caused by application code storing some
>> value in the
>> > > > >> wrong scope, or erroneous use of static variables.  Storing a
>> > > > >> request-specific item in the session or servlet objects is
>> one such
>> > > > >> example.
>> > > > >>
>> > > > >>  - Chuck
>> > > > >
>> > > > > I store a 'UserSession' object in Tomcats session but it does
>> not
>> > > > > contain a variable called "id".  This is the only
>> variable/object that
>> > > > > I am storing in that scope.  Everything else is using the 'page'
>> > > > > scope.
>> > > > >
>> > > > > I am passing the "id" parameter through the URL (HTTP GET
>> Method).
>> > > > >
>> > > > > The Generated HTML looks like this:
>> > > > >
>> > > > > <a class="row" href="javascript:showCa(1818);">1818
>> 2007/04/13</a>
>> > > > >
>> > > > > The showCa function:
>> > > > >
>> > > > > function showCap( vId ) {
>> > > > >
>> > > > >
>> > > > >    top.location.href="showCa.jsp?editFlag=" +
>> > > > > document.theForm.editFlag.value  + "&activeTab=" +
>> > > > > document.theForm.activeTab.value + "&id=" + vId;
>> > > > >
>> > > > >
>> > > > > }
>> > > > >
>> > > > > The JavaScript function redirects the browser.
>> > > > >
>> > > > > On the showCa page the URL in the browser has the right ID.  The
>> > > > > request.getQueryString(); returns the proper query string but
>> the
>> > > > > request.getParameter("id") does not return the id that is in
>> the URL
>> > > > > or QueryString
>> > > > >
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > To start a new topic, e-mail: users@tomcat.apache.org
>> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
>> > > > >
>> > > > >
>> > > >
>> > > >
>> ---------------------------------------------------------------------
>> > > > To start a new topic, e-mail: users@tomcat.apache.org
>> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > > > For additional commands, e-mail: users-help@tomcat.apache.org
>> > > >
>> > > >
>> > >
>> > >
>> ---------------------------------------------------------------------
>> > > To start a new topic, e-mail: users@tomcat.apache.org
>> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > > For additional commands, e-mail: users-help@tomcat.apache.org
>> > >
>> > >
>> >
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
Also,  If you have any information about declaring a variable with !
I would like to know.  I am having trouble finding any on google and
my JSP book.

On 5/8/07, Richard Sayre <ri...@gmail.com> wrote:
> Yes the right values are passed.  Th eonly one of those variable that
> really efects the data on the page is vId, which is hard coded into
> the <a href="..">
>
> I started to look in the _jspService and I noticed the the variable
> which I assign the request.getParameter("id") to is not in that
> method.
>
> The variable is called 'theID'.  One thing I noticed about it is it is
> declared like this
>
> !String theID;
>
> I have never seen this before.  Does this make the variable static?
> If so then it is obvious why this is happening
>
> I am going to look up this ! operator to see what it does. I 3 years I
> have never encountered it.  Hopefully removing it will solve my
> problem.  I will keep you updated.
>
>
> On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
> > First, I'd just make sure you are passing the right value from the form.
> > alert() the (editFlag=" + document.theForm.editFlag.value  + "&activeTab=" +
> > document.theForm.activeTab.value + "&id=" + vId;) string before you do the
> > location.href to be sure.
> >
> > Given that you are saying it works until multiple users access... it sounds
> > like there is some variables in the wrong scope.  Recall that a JSP is
> > compiled to a normal servlet by the container, and servlets are shared
> > resources.  so.. if you are putting the value into a "shared" area within
> > the jsp/servlet, it would make sense that you get strange results with
> > multiple users.
> >
> > All local (page scope) variables *should* be defined within the "service"
> > method of the compiled servlet, and hence shouldn't cause a problem.. so I
> > can only think you are placing the variable in some sort of static
> > location?
> >
> > If you say that the query string shows the correct location.. then things
> > are really strange.  Does the address in the browser show the correct
> > location/url?
> >
> >
> >
> > On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> > >
> > > Sorry about that.  When I copied and pasted I missed the function name
> > > and I typed it in manually.  I double checked and the function name is
> > > spelled correctly.  This code works normally until multiple users
> > > login.
> > >
> > > I pass these values the JSP page when the following JavaScript executes:
> > >
> > > top.location.href="showCa.jsp?editFlag=" +
> > > document.theForm.editFlag.value  + "&activeTab=" +
> > > document.theForm.activeTab.value + "&id=" + vId;
> > >
> > >
> > > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> > > > you are calling js function named 'showCa'
> > > > but your javascript function name is 'showCap'
> > > > When/Where do you actually pass these values to servlet?
> > > >
> > > > M--
> > > > This email message and any files transmitted with it contain
> > > confidential
> > > > information intended only for the person(s) to whom this email message
> > > is
> > > > addressed.  If you have received this email message in error, please
> > > notify
> > > > the sender immediately by telephone or email and destroy the original
> > > > message without making a copy.  Thank you.
> > > >
> > > > ----- Original Message -----
> > > > From: "Richard Sayre" <ri...@gmail.com>
> > > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > > > Sent: Tuesday, May 08, 2007 9:55 AM
> > > > Subject: Re: request.getParameter is returning the wrong value
> > > >
> > > >
> > > > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> > > > >> > Subject: request.getParameter is returning the wrong value
> > > > >> >
> > > > >> > The problem I am have is when a user clicks the link
> > > > >> > showCa.jsp?id=2345
> > > > >> >
> > > > >> > The request.getParameter("id") is returning the wrong id!
> > > > >>
> > > > >> This is usually caused by application code storing some value in the
> > > > >> wrong scope, or erroneous use of static variables.  Storing a
> > > > >> request-specific item in the session or servlet objects is one such
> > > > >> example.
> > > > >>
> > > > >>  - Chuck
> > > > >
> > > > > I store a 'UserSession' object in Tomcats session but it does not
> > > > > contain a variable called "id".  This is the only variable/object that
> > > > > I am storing in that scope.  Everything else is using the 'page'
> > > > > scope.
> > > > >
> > > > > I am passing the "id" parameter through the URL (HTTP GET Method).
> > > > >
> > > > > The Generated HTML looks like this:
> > > > >
> > > > > <a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>
> > > > >
> > > > > The showCa function:
> > > > >
> > > > > function showCap( vId ) {
> > > > >
> > > > >
> > > > >    top.location.href="showCa.jsp?editFlag=" +
> > > > > document.theForm.editFlag.value  + "&activeTab=" +
> > > > > document.theForm.activeTab.value + "&id=" + vId;
> > > > >
> > > > >
> > > > > }
> > > > >
> > > > > The JavaScript function redirects the browser.
> > > > >
> > > > > On the showCa page the URL in the browser has the right ID.  The
> > > > > request.getQueryString(); returns the proper query string but the
> > > > > request.getParameter("id") does not return the id that is in the URL
> > > > > or QueryString
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
Yes the right values are passed.  Th eonly one of those variable that
really efects the data on the page is vId, which is hard coded into
the <a href="..">

I started to look in the _jspService and I noticed the the variable
which I assign the request.getParameter("id") to is not in that
method.

The variable is called 'theID'.  One thing I noticed about it is it is
declared like this

!String theID;

I have never seen this before.  Does this make the variable static?
If so then it is obvious why this is happening

I am going to look up this ! operator to see what it does. I 3 years I
have never encountered it.  Hopefully removing it will solve my
problem.  I will keep you updated.


On 5/8/07, Jason Polites <ja...@gmail.com> wrote:
> First, I'd just make sure you are passing the right value from the form.
> alert() the (editFlag=" + document.theForm.editFlag.value  + "&activeTab=" +
> document.theForm.activeTab.value + "&id=" + vId;) string before you do the
> location.href to be sure.
>
> Given that you are saying it works until multiple users access... it sounds
> like there is some variables in the wrong scope.  Recall that a JSP is
> compiled to a normal servlet by the container, and servlets are shared
> resources.  so.. if you are putting the value into a "shared" area within
> the jsp/servlet, it would make sense that you get strange results with
> multiple users.
>
> All local (page scope) variables *should* be defined within the "service"
> method of the compiled servlet, and hence shouldn't cause a problem.. so I
> can only think you are placing the variable in some sort of static
> location?
>
> If you say that the query string shows the correct location.. then things
> are really strange.  Does the address in the browser show the correct
> location/url?
>
>
>
> On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
> >
> > Sorry about that.  When I copied and pasted I missed the function name
> > and I typed it in manually.  I double checked and the function name is
> > spelled correctly.  This code works normally until multiple users
> > login.
> >
> > I pass these values the JSP page when the following JavaScript executes:
> >
> > top.location.href="showCa.jsp?editFlag=" +
> > document.theForm.editFlag.value  + "&activeTab=" +
> > document.theForm.activeTab.value + "&id=" + vId;
> >
> >
> > On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> > > you are calling js function named 'showCa'
> > > but your javascript function name is 'showCap'
> > > When/Where do you actually pass these values to servlet?
> > >
> > > M--
> > > This email message and any files transmitted with it contain
> > confidential
> > > information intended only for the person(s) to whom this email message
> > is
> > > addressed.  If you have received this email message in error, please
> > notify
> > > the sender immediately by telephone or email and destroy the original
> > > message without making a copy.  Thank you.
> > >
> > > ----- Original Message -----
> > > From: "Richard Sayre" <ri...@gmail.com>
> > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > > Sent: Tuesday, May 08, 2007 9:55 AM
> > > Subject: Re: request.getParameter is returning the wrong value
> > >
> > >
> > > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> > > >> > Subject: request.getParameter is returning the wrong value
> > > >> >
> > > >> > The problem I am have is when a user clicks the link
> > > >> > showCa.jsp?id=2345
> > > >> >
> > > >> > The request.getParameter("id") is returning the wrong id!
> > > >>
> > > >> This is usually caused by application code storing some value in the
> > > >> wrong scope, or erroneous use of static variables.  Storing a
> > > >> request-specific item in the session or servlet objects is one such
> > > >> example.
> > > >>
> > > >>  - Chuck
> > > >
> > > > I store a 'UserSession' object in Tomcats session but it does not
> > > > contain a variable called "id".  This is the only variable/object that
> > > > I am storing in that scope.  Everything else is using the 'page'
> > > > scope.
> > > >
> > > > I am passing the "id" parameter through the URL (HTTP GET Method).
> > > >
> > > > The Generated HTML looks like this:
> > > >
> > > > <a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>
> > > >
> > > > The showCa function:
> > > >
> > > > function showCap( vId ) {
> > > >
> > > >
> > > >    top.location.href="showCa.jsp?editFlag=" +
> > > > document.theForm.editFlag.value  + "&activeTab=" +
> > > > document.theForm.activeTab.value + "&id=" + vId;
> > > >
> > > >
> > > > }
> > > >
> > > > The JavaScript function redirects the browser.
> > > >
> > > > On the showCa page the URL in the browser has the right ID.  The
> > > > request.getQueryString(); returns the proper query string but the
> > > > request.getParameter("id") does not return the id that is in the URL
> > > > or QueryString
> > > >
> > > > ---------------------------------------------------------------------
> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Jason Polites <ja...@gmail.com>.
First, I'd just make sure you are passing the right value from the form.
alert() the (editFlag=" + document.theForm.editFlag.value  + "&activeTab=" +
document.theForm.activeTab.value + "&id=" + vId;) string before you do the
location.href to be sure.

Given that you are saying it works until multiple users access... it sounds
like there is some variables in the wrong scope.  Recall that a JSP is
compiled to a normal servlet by the container, and servlets are shared
resources.  so.. if you are putting the value into a "shared" area within
the jsp/servlet, it would make sense that you get strange results with
multiple users.

All local (page scope) variables *should* be defined within the "service"
method of the compiled servlet, and hence shouldn't cause a problem.. so I
can only think you are placing the variable in some sort of static
location?

If you say that the query string shows the correct location.. then things
are really strange.  Does the address in the browser show the correct
location/url?



On 5/9/07, Richard Sayre <ri...@gmail.com> wrote:
>
> Sorry about that.  When I copied and pasted I missed the function name
> and I typed it in manually.  I double checked and the function name is
> spelled correctly.  This code works normally until multiple users
> login.
>
> I pass these values the JSP page when the following JavaScript executes:
>
> top.location.href="showCa.jsp?editFlag=" +
> document.theForm.editFlag.value  + "&activeTab=" +
> document.theForm.activeTab.value + "&id=" + vId;
>
>
> On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> > you are calling js function named 'showCa'
> > but your javascript function name is 'showCap'
> > When/Where do you actually pass these values to servlet?
> >
> > M--
> > This email message and any files transmitted with it contain
> confidential
> > information intended only for the person(s) to whom this email message
> is
> > addressed.  If you have received this email message in error, please
> notify
> > the sender immediately by telephone or email and destroy the original
> > message without making a copy.  Thank you.
> >
> > ----- Original Message -----
> > From: "Richard Sayre" <ri...@gmail.com>
> > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > Sent: Tuesday, May 08, 2007 9:55 AM
> > Subject: Re: request.getParameter is returning the wrong value
> >
> >
> > > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> > >> > Subject: request.getParameter is returning the wrong value
> > >> >
> > >> > The problem I am have is when a user clicks the link
> > >> > showCa.jsp?id=2345
> > >> >
> > >> > The request.getParameter("id") is returning the wrong id!
> > >>
> > >> This is usually caused by application code storing some value in the
> > >> wrong scope, or erroneous use of static variables.  Storing a
> > >> request-specific item in the session or servlet objects is one such
> > >> example.
> > >>
> > >>  - Chuck
> > >
> > > I store a 'UserSession' object in Tomcats session but it does not
> > > contain a variable called "id".  This is the only variable/object that
> > > I am storing in that scope.  Everything else is using the 'page'
> > > scope.
> > >
> > > I am passing the "id" parameter through the URL (HTTP GET Method).
> > >
> > > The Generated HTML looks like this:
> > >
> > > <a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>
> > >
> > > The showCa function:
> > >
> > > function showCap( vId ) {
> > >
> > >
> > >    top.location.href="showCa.jsp?editFlag=" +
> > > document.theForm.editFlag.value  + "&activeTab=" +
> > > document.theForm.activeTab.value + "&id=" + vId;
> > >
> > >
> > > }
> > >
> > > The JavaScript function redirects the browser.
> > >
> > > On the showCa page the URL in the browser has the right ID.  The
> > > request.getQueryString(); returns the proper query string but the
> > > request.getParameter("id") does not return the id that is in the URL
> > > or QueryString
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
Sorry about that.  When I copied and pasted I missed the function name
and I typed it in manually.  I double checked and the function name is
spelled correctly.  This code works normally until multiple users
login.

I pass these values the JSP page when the following JavaScript executes:

top.location.href="showCa.jsp?editFlag=" +
document.theForm.editFlag.value  + "&activeTab=" +
document.theForm.activeTab.value + "&id=" + vId;


On 5/8/07, Martin Gainty <mg...@hotmail.com> wrote:
> you are calling js function named 'showCa'
> but your javascript function name is 'showCap'
> When/Where do you actually pass these values to servlet?
>
> M--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
> ----- Original Message -----
> From: "Richard Sayre" <ri...@gmail.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, May 08, 2007 9:55 AM
> Subject: Re: request.getParameter is returning the wrong value
>
>
> > On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> >> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> >> > Subject: request.getParameter is returning the wrong value
> >> >
> >> > The problem I am have is when a user clicks the link
> >> > showCa.jsp?id=2345
> >> >
> >> > The request.getParameter("id") is returning the wrong id!
> >>
> >> This is usually caused by application code storing some value in the
> >> wrong scope, or erroneous use of static variables.  Storing a
> >> request-specific item in the session or servlet objects is one such
> >> example.
> >>
> >>  - Chuck
> >
> > I store a 'UserSession' object in Tomcats session but it does not
> > contain a variable called "id".  This is the only variable/object that
> > I am storing in that scope.  Everything else is using the 'page'
> > scope.
> >
> > I am passing the "id" parameter through the URL (HTTP GET Method).
> >
> > The Generated HTML looks like this:
> >
> > <a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>
> >
> > The showCa function:
> >
> > function showCap( vId ) {
> >
> >
> >    top.location.href="showCa.jsp?editFlag=" +
> > document.theForm.editFlag.value  + "&activeTab=" +
> > document.theForm.activeTab.value + "&id=" + vId;
> >
> >
> > }
> >
> > The JavaScript function redirects the browser.
> >
> > On the showCa page the URL in the browser has the right ID.  The
> > request.getQueryString(); returns the proper query string but the
> > request.getParameter("id") does not return the id that is in the URL
> > or QueryString
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Martin Gainty <mg...@hotmail.com>.
you are calling js function named 'showCa' 
but your javascript function name is 'showCap'
When/Where do you actually pass these values to servlet?

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Richard Sayre" <ri...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, May 08, 2007 9:55 AM
Subject: Re: request.getParameter is returning the wrong value


> On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
>> > From: Richard Sayre [mailto:richardsayre@gmail.com]
>> > Subject: request.getParameter is returning the wrong value
>> >
>> > The problem I am have is when a user clicks the link
>> > showCa.jsp?id=2345
>> >
>> > The request.getParameter("id") is returning the wrong id!
>>
>> This is usually caused by application code storing some value in the
>> wrong scope, or erroneous use of static variables.  Storing a
>> request-specific item in the session or servlet objects is one such
>> example.
>>
>>  - Chuck
> 
> I store a 'UserSession' object in Tomcats session but it does not
> contain a variable called "id".  This is the only variable/object that
> I am storing in that scope.  Everything else is using the 'page'
> scope.
> 
> I am passing the "id" parameter through the URL (HTTP GET Method).
> 
> The Generated HTML looks like this:
> 
> <a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>
> 
> The showCa function:
> 
> function showCap( vId ) {
> 
> 
>    top.location.href="showCa.jsp?editFlag=" +
> document.theForm.editFlag.value  + "&activeTab=" +
> document.theForm.activeTab.value + "&id=" + vId;
>    
> 
> }
> 
> The JavaScript function redirects the browser.
> 
> On the showCa page the URL in the browser has the right ID.  The
> request.getQueryString(); returns the proper query string but the
> request.getParameter("id") does not return the id that is in the URL
> or QueryString
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: request.getParameter is returning the wrong value

Posted by Richard Sayre <ri...@gmail.com>.
On 5/8/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > From: Richard Sayre [mailto:richardsayre@gmail.com]
> > Subject: request.getParameter is returning the wrong value
> >
> > The problem I am have is when a user clicks the link
> > showCa.jsp?id=2345
> >
> > The request.getParameter("id") is returning the wrong id!
>
> This is usually caused by application code storing some value in the
> wrong scope, or erroneous use of static variables.  Storing a
> request-specific item in the session or servlet objects is one such
> example.
>
>  - Chuck

I store a 'UserSession' object in Tomcats session but it does not
contain a variable called "id".  This is the only variable/object that
I am storing in that scope.  Everything else is using the 'page'
scope.

I am passing the "id" parameter through the URL (HTTP GET Method).

The Generated HTML looks like this:

<a class="row" href="javascript:showCa(1818);">1818 2007/04/13</a>

The showCa function:

function showCap( vId ) {


    	top.location.href="showCa.jsp?editFlag=" +
document.theForm.editFlag.value  + "&activeTab=" +
document.theForm.activeTab.value + "&id=" + vId;
    	

}

The JavaScript function redirects the browser.

On the showCa page the URL in the browser has the right ID.  The
request.getQueryString(); returns the proper query string but the
request.getParameter("id") does not return the id that is in the URL
or QueryString

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: request.getParameter is returning the wrong value

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Richard Sayre [mailto:richardsayre@gmail.com] 
> Subject: request.getParameter is returning the wrong value
> 
> The problem I am have is when a user clicks the link 
> showCa.jsp?id=2345
> 
> The request.getParameter("id") is returning the wrong id!

This is usually caused by application code storing some value in the
wrong scope, or erroneous use of static variables.  Storing a
request-specific item in the session or servlet objects is one such
example.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org