aspose file tools*
The moose likes Servlets and the fly likes Resetting Values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Resetting Values" Watch "Resetting Values" New topic
Author

Resetting Values

Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
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.


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

Is the registration page a static (HTML) page or is it generated dynamically by a servlet or JSP?
Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
It's a dynamic page.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resetting Values