File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Message to show database update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Message to show database update" Watch "Message to show database update" New topic

Message to show database update

Anjali Ajwani

Joined: Jan 18, 2001
Posts: 16
I have a form in a JSP page which accepts several fields from the user. After entering these fields the user can select either "Add this vendor" or "Add Location for this vendor". If "Add this Vendor" is selected, the controller servlet will insert all these fields into the database.
Once the values are inserted in the database(executeUpdate() is done), the user should see a message saying "Insert successful" and also come back to this first JSP, so that he can enter "Location" now. How do I achieve this?
Sam Dalton
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
Have your servlet redirect (via the requestdispatcher) to the success (or failure) page. The page can have a meta tag that forwards onto the first JSP page after a predefined period of time.

<a href="" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of []Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
Anjali Ajwani

Joined: Jan 18, 2001
Posts: 16
The first part(requestdispatcher), I had done yesterday. How do I do the second one....sending the control to JSP after lapse of some seconds? Which package can I find this in?
I agree. Here's the link:
subject: Message to show database update
It's not a secret anymore!