• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to keep input when back to this page?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic