• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resetting Values

 
Yogendra Joshi
Ranch Hand
Posts: 213
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

I have a problem in hand. I have a registration form in which there are 12 fields. The main field is username, when the user fills all the fields, the details are submitted to the database. If the username already exists, the user is taken back to the registration page to enter the new username.
I have a Servlet in which i have a RequestDispatcher.include which takes that user back to the registration page.

Now the problem is , if the username already exists the user is taken back to the registration page successfully, however all the deatils filled in by the user gets cleared which i don't want. What i want is all the details should get prepopulated and the user should be made to enter only the new username.

Kindly help me with the possible solution which is available with you'll.

Thanks in Advance,

Yogi.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the registration page a static (HTML) page or is it generated dynamically by a servlet or JSP?
 
Yogendra Joshi
Ranch Hand
Posts: 213
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a dynamic page.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then when you generate it, you can generate it complete with the data that came in on the request, can't you?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64204
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yogendra Joshi:
I have a Servlet in which i have a RequestDispatcher.include which takes that user back to the registration page.


An include? That's really really odd. A forward or redirect is much more customary.

In any case, as Paul suggested send the data back to the page and use the value attibutes of the form elements to pre-populate them
[ March 22, 2007: Message edited by: Bear Bibeault ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic