Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to dynamically remind the user of registration errors?

 
Mark Lau
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, my web application requires user registration.
Say, on the registration page, I want to have the user enter the following information to register with my site:
User name:
Password:
Password again:
First name:
Last name:
E-mail:
Phone:
Suppose the user enters a user name that is already taken by somebody, and everything else is acceptable. After the user hits the "Register" button, my servlet detects the user name problem. Then I want to go back to the registration page, with a message in red at the top "The user name has been taken, please try another one."
Or suppose, in addition to the user name problem, the two entries of passwords do not match each other, I want to go back to the registration page with two messages in red at the top "The user name has been taken, please try another one.", "The passwords you enter do not match."
By now, you must have understood my question. It's just something everybody has ever seen.
How do I achieve this? My site is being built using servlet, JSP, JDBC and Java Beans.
Thanks.
 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes this is very much possible. Perhaps this could be achieved by following method:-
1. keep all your fields of registartion in an array i.e. sya regitem[0]=name,regitem[1]=email etc.
2. make a another array with respective fields as boolean.
3. make a query to database whatever user has given. and for every fields make the array yes or no.
4. against this array message put the value of regitems array in different colors. Perhaps this will become more easier if you can use CSS Pages.
regards,
arun
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear arun
could u please put more light on this, i couldnt understand it properly.
malhar
 
Syam Veerakumar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its always better to check for the password match in the front end itself using Java Script, so that u may not waste the server time and Network time as well as User's time.
To check the username u can give like this,
userName = request.getParameter("username");
//Check it here using JDBC
If the the name already exists
Populate a vector like
Vector ErrVect = new Vector();
ErrVect.addElement("User Name already exists....etc");
Add this vector to session.
and redirect to Registration page.
In the Registration page check the vector is not null,if the vector is not null,then display its content.
If u cudn't understand this inform me, i'll send u the full code.
[ February 02, 2002: Message edited by: Syam Veerakumar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic