This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

input box for variable x is null in jsp but in servlet the method x.length() returns 10

 
ashley Jug
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i have the following jsp as my log in page:



The following code is my servlet:



However even when the username and password is null in the log in page the logger for passwrd.length() and name.length() is int 10.
When i run name.trim().length() it returns int 0.

How is it initialising a null input box?
Any suggestion please?

Thanks in advance.
 
Paul Clapham
Sheriff
Pie
Posts: 20950
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand. The HTML you posted there is going to be displayed to the user, and they are going to fill in the fields and press the Submit button, right? And then that's going to submit the fields to the servlet code you posted, right?

And you described the HTML you posted as a JSP. So your JSP generates the HTML and sends it to the browser, where the user will then fill in the fields. So I don't see why you would expect the JSP to contain that data, when the user hasn't even typed it yet.
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what this logger.info() does..?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prashant chindhade wrote:what this logger.info() does..?

Log4J
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic