• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to keep input when back to this page?  RSS feed

 
nian zhang
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just like a login system,
there is a userid and password input on my webpage.
when submit the page, verify.jsp verify the inputs, if ok go to somepage, else verify should say some thing missing and provide a link to go back to login page.
i want to keep all the information user already entered. how?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi nian, welcome to the Ranch!
If your verification JSP (might I recommend using servlets for processing rather than JSPs?) forwards the request back to the login page after it determines that the login fails, the request parameters are still available to the request.
It should be an easy task to code the login page such that it could detect this condition, and to use the value attributes on the form controls to set their initial values from the submitted request parameters.
hth,
bear
 
toma lam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easier way would be to do as stated above, which would be to have the verify.jsp (or a servlet) forward back to the login page. The login page can access the parameters in the request object and you're set.
If you would rather have verify.jsp provide a link so the user can click on it to go back to the login page then you can probably do several things:
1. Provide all the values as querystring in the link. (most login pages always wipes out the password when either username or password is wrong so there's no need to add that to querystring). YOu can then access it from the request object.
2. Have all the values as hidden html form fields, then have the link submit the form which takes you to the login page. You can access all values from request object.
Cool, let us know how it goes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!