• 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
Posts: 21117
32
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: 64959
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic