Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is data type of textbox [JSP]  RSS feed

 
Novita Sihombing
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I wrote:
String a=request.getParameter("username");
where username is a textbox (<input type="textbox" name="username">

But when I want to know length of that string "a" by using a.length, it doesn't work.

Can somebody help me, what is the problem?
 
Manesh Kumar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be
a.length()
. It is function call not a field in String class.

The length field holds good for array objects.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The return type for getParameter is String.

It will return null if the parameter you're looking for doesn't exist in the request.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!