Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

request.getParameter()  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am passing a value in query string to another page. i am getting the value through request.getParameter().i pass null value in the query string.in if condition will be procedded if the got value is not null but the condition is executed for null value. can some one help me out.

My code
-------
jsp1
----


String notiToken = null;
<input type="hidden" name="token" value="<%=notiToken%>">



jsp2
----

String token = null;

token = request.getParameter("token");

out.println("token="+token);
if(token!=null){
out.println("token inside if="+token);
}
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry mate but I did not understand your doubt. Can you be more clear?
 
yesukannan jeyaraj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i pass a null value in query string to another page. in that page i process a condition if the value is not null. but in my senario the condition executed for the null value.
 
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by yesukannan jeyaraj:

My code
-------
jsp1
----


String notiToken = null;
<input type="hidden" name="token" value="<%=notiToken%>">





Try this out..

I think now you understand....

Hope this helps..
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
value="<%=notiToken%>"
will not return null.
It will either pass the string "null" or an empty string.

If you want the value to be null, simply don't pass anything.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!