• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

request.getParameter()

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic