File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes alert in servlet with 'Are you sure you want to delete?' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "alert in servlet with Watch "alert in servlet with New topic
Author

alert in servlet with 'Are you sure you want to delete?'

lisy jessica
Ranch Hand

Joined: Oct 27, 2010
Posts: 47
Hi

I want to delete record from oracle db, i need alert message saying 'Are you sure you want to delete?' with yes and no buttons, if yes, the data should delete if no control shd be in the same page(retrieve.jsp). I have no idea how to do this...the previous page is retrieve.jsp which has the data, based on form input with edit and Delete button end of each row, when i click delete it shd alert me....This is my servlet code:

DeleteData.java




Please help me.

Thanks in advance, Lissy
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hello,
In retrieve.jsp itself you can embed the Javascript that will show user the alert message. In the same Javascript function you can check the user response and continue invoking your DeleteData servlet.
There are couple of other things that you can improve even if you are doing example.
1) Do not embed HTML inside the DeleteData. Read about MVC2 and use JSP for that purpose. I guess you are already doing that in retrieve.jsp as you mentioned.
2) Close the database resources in finally block to make sure they are called even if you encounter exception in your code.

Regds,
Amit
lisy jessica
Ranch Hand

Joined: Oct 27, 2010
Posts: 47
Thank you for the reply...will try this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: alert in servlet with 'Are you sure you want to delete?'