Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checking user inputs

 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how would i check the user's input in a servlets. for example, i have a five textbox, how would the program know if these textbox are all fill up before you hit the submit button. can i use javascript in servlets?

raymond
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by raymond yadao:
how would i check the user's input in a servlets. for example, i have a five textbox, how would the program know if these textbox are all fill up before you hit the submit button. can i use javascript in servlets?


Yeah obviously u need to validate the html form using javascript or using serverside validation.U can embed javascript in html which is being pumped out by servlet's PrintWriter or OutputStream.
Anil
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call the getParameter() method on req and check whether the input is null or has a length of zero on all of the text boxes.
 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marilyn deQueiroz:
Call the getParameter() method on req and check whether the input is null or has a length of zero on all of the text boxes.

but this can only be done as soon as u click the submit button. what i want is that, from the client browser it will check now if all the text boxes are fill up. so if it find that one has been leave blanks it will alert the user that some text boxes has not been leave blank.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything that is done on the client really sneeds to be done in JavaScript. Try asking this in the "HTML and JavaScript forum".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic