You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Erik Price <ep...@ptc.com> on 2003/01/23 23:16:22 UTC
strange response.getAttribute problem
In my index.jsp file, I have the following snippet of code:
<input type="hidden" name="dest" value="<%=
response.getAttribute("dest") %>" />
I'm trying to capture the value of the "dest" URL parameter. I tried
setting it as an attribute in the response object that redirects to
index.jsp, and that didn't work. But I thought for sure that if I
hardcoded it into the URL, it would work. Strangely, if I call
index.jsp with the following URL:
domain.com:8080/webapp/index.jsp?dest=/test/path
Then the JSP renders as such:
<input type="hidden" name="dest" value="null" />
any idea why the GET attribute's not getting pulled into the JSP?
Thanks,
Erik
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: strange response.getAttribute problem
Posted by Erik Price <ep...@ptc.com>.
Bill Lunnon wrote:
> Try
> request.getParameter()
I must have been mixed up -- I could have sworn that they were
getAttribute()! Thanks Bill.
> also
> you should test for null on the parameter (it will probably cause a
> NullPointerException down the line)
Yes, it returns the string "null" which my servlet will check for. Thanks.
Erik
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: strange response.getAttribute problem
Posted by Bill Lunnon <bi...@mirrim.com.au>.
Try
request.getParameter()
also
you should test for null on the parameter (it will probably cause a
NullPointerException down the line)
HTH
Bill
-----Original Message-----
From: Erik Price [mailto:eprice@ptc.com]
Sent: Friday, 24 January 2003 9:16 AM
To: Tomcat Users List
Subject: strange response.getAttribute problem
In my index.jsp file, I have the following snippet of code:
<input type="hidden" name="dest" value="<%=
response.getAttribute("dest") %>" />
I'm trying to capture the value of the "dest" URL parameter. I tried
setting it as an attribute in the response object that redirects to
index.jsp, and that didn't work. But I thought for sure that if I
hardcoded it into the URL, it would work. Strangely, if I call
index.jsp with the following URL:
domain.com:8080/webapp/index.jsp?dest=/test/path
Then the JSP renders as such:
<input type="hidden" name="dest" value="null" />
any idea why the GET attribute's not getting pulled into the JSP?
Thanks,
Erik
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: strange response.getAttribute problem
Posted by Ron Day <ro...@ronday.cc>.
getAttribute returns 'Object'. You need to cast it to 'String'
Ron
-----Original Message-----
From: Erik Price [mailto:eprice@ptc.com]
Sent: Thursday, January 23, 2003 4:16 PM
To: Tomcat Users List
Subject: strange response.getAttribute problem
In my index.jsp file, I have the following snippet of code:
<input type="hidden" name="dest" value="<%=
response.getAttribute("dest") %>" />
I'm trying to capture the value of the "dest" URL parameter. I tried
setting it as an attribute in the response object that redirects to
index.jsp, and that didn't work. But I thought for sure that if I
hardcoded it into the URL, it would work. Strangely, if I call
index.jsp with the following URL:
domain.com:8080/webapp/index.jsp?dest=/test/path
Then the JSP renders as such:
<input type="hidden" name="dest" value="null" />
any idea why the GET attribute's not getting pulled into the JSP?
Thanks,
Erik
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: strange response.getAttribute problem
Posted by Erik Price <ep...@ptc.com>.
Ron Day wrote:
> also its request.getAttribute, not response.getAttribute.
Sorry, typo ... ;)
Erik
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: strange response.getAttribute problem
Posted by Ron Day <ro...@ronday.cc>.
also its request.getAttribute, not response.getAttribute.
-----Original Message-----
From: Erik Price [mailto:eprice@ptc.com]
Sent: Thursday, January 23, 2003 4:16 PM
To: Tomcat Users List
Subject: strange response.getAttribute problem
In my index.jsp file, I have the following snippet of code:
<input type="hidden" name="dest" value="<%=
response.getAttribute("dest") %>" />
I'm trying to capture the value of the "dest" URL parameter. I tried
setting it as an attribute in the response object that redirects to
index.jsp, and that didn't work. But I thought for sure that if I
hardcoded it into the URL, it would work. Strangely, if I call
index.jsp with the following URL:
domain.com:8080/webapp/index.jsp?dest=/test/path
Then the JSP renders as such:
<input type="hidden" name="dest" value="null" />
any idea why the GET attribute's not getting pulled into the JSP?
Thanks,
Erik
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>