• Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getParameter()

 
Nijeesh Balan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm submitting a form from a jsp without any values in a textbox named "txtboxname". When I do request.getParameter("txtboxname") in the servlet i receive the value as "" instead of null.
Can someone let me know if this is an expected behaviour or is this something different???
We are using Websphere 4.0.4 and IBM Http Server.
Thanks & Regards,
Nijeesh.
 
Mike DeStefano
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only time you would get null is if the requested parameter did not get submitted. When a textbox parameter is submitted empty --> (""), that's exactly what you will get get, an empty String, or "".....
If the named parameter doesn't exist, for example, you mistype the name on the request.getParamter("oops") command, you will get null.
 
Nijeesh Balan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops!!!
Sorry.. I think I just got out of my mind...
Thanks for your reply Mike..
Regards,
Nijeesh.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!