Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is data type of textbox [JSP]

 
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.
 
Danger, 10,000 volts, very electic .... tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!