• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Resetting Values

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 28370
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a dynamic page.
 
Paul Clapham
Sheriff
Posts: 28370
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67753
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

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 ]
 
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic