• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using FORM and INPUT  RSS feed

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I've got a simple JSP that uses FORM, ACTION and INPUT to
let the user input a password. At the moment, the ACTION takes the user into another JSP, so that the password can be checked.

This JSP, uses
request.getParameter("pass")
to check the parameter is correct.
Since the amount of code in this JSP is so small, I would like to just do this inside the first JSP, but I don't know how to refer to the value just inputted.

Any ideas??
 
te zhang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just request.getParameter("the input component name ");
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to just do this inside the first JSP


That makes no sense. The 1st JSP is the used to generate the HTML page with your form and send it to the browser. Code in that JSP executes before the user even sees the page.

If you want to perform on-page validation prior to submitting the form, you'll need to use Javascript on the page for that.
 
Ajay Krihnamurthy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi you can do the User ID Validation in the first jsp itself. Create a hidden field named as MODE in the first JSP. If the user press the "LOGIN" button forward the request to the same page. In top of the first page u can get the value of the "pass" using request.getParamater("pass"). and check whether the password and user name are valid if they are valid then forward the page to the success page...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!