File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes checking user inputs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "checking user inputs" Watch "checking user inputs" New topic
Author

checking user inputs

raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
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

Joined: Oct 31, 2000
Posts: 527
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

SCJP 1.5, SCEA, ICED (287,484,486)
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9001
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.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
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

Joined: Jan 07, 1999
Posts: 6913
Anything that is done on the client really sneeds to be done in JavaScript. Try asking this in the "HTML and JavaScript forum".


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
 
subject: checking user inputs
 
Threads others viewed
validation for numbers and alphabets
values from jsp to servlet
saving the details in when i click next and previous buttons
Need to convert Console App to GUI...
dynamic page
IntelliJ Java IDE