| Author |
How do we memorize user input at a registration page?
|
Mark Lau
Ranch Hand
Joined: Dec 15, 2001
Posts: 120
|
|
Suppose I have a basic registration page on which the customer needs to enter such info: email: password: password: first name: last name: Suppose, after the customer hits the "submit" button, my servlet finds that the 2 passwords he/she has entered are not the same, then we return to the same registration page. Now, here is the problem. After we return to the same registration page, the data the customer has entered are all lost. He/she has to enter his email, first name, last name again! My question is: how can we memorize the user input so that when we return to the same registration page, we restore everything the customer has entered except the password? Can I do it like this? First name <INPUT TYPE="TEXT" NAME="firstname" <% if ( request.getParameter("firstname") != null) %> VALUE = <%= request.getParameter("firstname") %> ><BR> Last name <INPUT TYPE="TEXT" NAME="lastname" <% if ( request.getParameter("lastname") != null) %> VALUE = <%= request.getParameter("lastname") %> ><BR> I tried this, but it did not work nicely. Or do we have any other approach to this problem? I don't know if mine is right. It would be nice if you guys can paste a snippet of your sample code. I believe this many of you have such experiences. Thanks. Gene [ March 16, 2002: Message edited by: Gene Chao ]
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
|
|
You could put data from the form into the session. In your form generating code, if the data exists in the session, insert it otherwise insert "" Bill
|
Java Resources at www.wbrogden.com
|
 |
Mark Lau
Ranch Hand
Joined: Dec 15, 2001
Posts: 120
|
|
Thanks a lot, it works now! Great. [ March 16, 2002: Message edited by: Gene Chao ]
|
 |
Tualha Khan
Ranch Hand
Joined: Nov 22, 2000
Posts: 287
|
|
you can also do: <form> <input type='button' value=Go Back & Edit' onclic='history.go(-1)'> </form> DO RECTIFY THE SPELLING OF ONCLIC This works for me!! Thanks & Bye, Tualha Khan
|
SCJP2, BEA WLS 6.0, DB2 UDB 7.1
|
 |
Mark Lau
Ranch Hand
Joined: Dec 15, 2001
Posts: 120
|
|
Tualha, Your version is JavaScript, isn't it?
|
 |
 |
|
|
subject: How do we memorize user input at a registration page?
|
|
|