Alert in Servlet

Alert in Servlet

<p>Hi</p>

<p>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.  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:</p>

<p>DeleteData.java</p>

<p>[code]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;</p>

<p>public class DeleteData extends HttpServlet {</p>

<pre class="prettyprint">public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
</code></pre>

<p>out.println("<title>Delete Page</title>" + "<h1 align=\"center\"></h1>" + "<body bgcolor=#99CCFF>");
out.println("<center><td align=\"center\" width=\"37\"> <strong><img title=\"Go back\" src=\"Undo.gif\" width=\"20\" height=\"20\" onClick=\"javascript:history.back()\" style=\"vertical-align:middle;\" onMouseOver=\"this.style.cursor='hand';\"></strong></td></center>");
        System.out.println("Oracle 10g Connect Example.");
        Connection conn = null;
        String url = "jdbc:oracle:thin:@10.44.6.75:1529:nrsprd";
        String driver = "oracle.jdbc.driver.OracleDriver";
        String user = "root";
        String pass = "root";
        String Cabinet =request.getParameter("Cabinet");
        Statement stmt;
        try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url, user, pass);
            System.out.println("Connected to the database");
            ArrayList al = null;
            ArrayList userList = new ArrayList();
            String query = "DELETE FROM Carr_ethernet  WHERE Cabinet='" + Cabinet + "'";
            stmt = conn.createStatement();
            int i = stmt.executeUpdate(query);
            System.out.println("query" + query);
            if (i > 0) {</p>

<pre class="prettyprint">            out.print("&lt;br&gt;");
            out.print("&lt;table  align=\"center\" style=\"background-color: white;\"width=\"50%\" border=\"1\"&gt;");
            out.print("&lt;tr&gt;&lt;th&gt;Data Deleted Successfully&lt;/th&gt;&lt;/tr&gt;");
            out.print("&lt;/table&gt;");
</code></pre>

<p> }
            conn.close();
            System.out.println("Disconnected from database");
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }</p>

<pre class="prettyprint">}
</code></pre>

<p>}
[/code]</p>

<p>Please help me.</p>

<p>Thanks in advance,
Lissy</p>
View Answers









Related Tutorials/Questions & Answers:
Alert in Servlet
of each row, when i click delete it shd alert me....This is my servlet code:<...Alert in Servlet  <p>Hi</p> <p>I want to delete record from oracle db, i need alert message saying 'Are you sure you want
Name Display in alert box - JSP-Servlet
Name Display in alert box  Dear Sir, Please any one help me... the alert box but the value is not in data base alert box is not display... AJAX and Servlet var xmlHttp; function checkUserExist() { var username
Advertisements
SMS alert system using Java - JSP-Servlet
SMS alert system using Java  Respected Sir/Mam, I need to develop an SMS alert application. Scope of the application: Basically... recipients. This can be developed using any kind of componentsThanks
SMS alert system in Java - JSP-Servlet
SMS alert system in Java  Hi, I have asked this questions 2 days before and awaiting answer. But i didn't get any replies so far?? Any experts please help me
https security alert messages - JSP-Servlet
https security alert messages  Hi, I have an application... that link, a security alert message is getting displayed. But initially, I logged into the same application by clicking the security alert and why the same
alert
alert  after pressing ok button in alert message it has to stop...; if(username==""){ alert("Enter Username!"); return false; } if(password==""){ alert("Enter Password!"); return false; } return true; } </script> <
alert in jsp
alert in jsp  if(pass.equals(pwd)) { Statement st1..."); %> alert("password is successfully changed"); <... Password"); %> <script> alert("please enter old Password
alert for validation
alert for validation  i want to put alert on the text box that enter...) if (cpos1==-1 || cpos2==-1){ alert("The date format must be : dd/mm/yyyy... || pmonth<1 || pmonth>12){ alert("Enter a valid month") return
change appearance of alert box
change appearance of alert box  how to change the appearance of an alert() box
GETTING ALERT MESSAGE
GETTING ALERT MESSAGE  how to get an alert message when radio button is selected instead of checkbox
Javascript alert message
Javascript alert message   How to send an alert message to a user in JavaScript
javascript prompt alert
javascript prompt alert   Sending a prompt alert using a JavaScript function
ModuleNotFoundError: No module named 'alert'
ModuleNotFoundError: No module named 'alert'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'alert' How to remove the ModuleNotFoundError: No module named 'alert'
GETTING AN ALERT MESSAGE
GETTING AN ALERT MESSAGE  how to get an alert message, if i select radio button instead of checkbox(associated with 3 dropdown list
JavaScript Alert YES NO
JavaScript Alert YES NO  How to send an alert to a user to confirm if there request is valid or not? I wants to send the alert message in Java Script... type="text/javascript"> function show_alert(my_string) { alert(my_string
sms/mail alert for dynamic web application
sms/mail alert for dynamic web application  hi friends, how can i integrate sms/mail alert with my dynamic web application created using servlet? can anyone give me any idea for this related coding
javascript statement alert
javascript statement alert  JavaScript Alert If Statement   JavaScript Alert if Statement <script type="text/javascript"> <...;/script> JavaScript Alert else if Statement <script type="text/javascript
alert box in iphone
alert box in iphone  hello, how can i show alert box in my iphone application??   hello,ADS_TO_REPLACE_1 you can use this code for show the alert .. UIAlertView *alt = [[UIAlertView alloc] initWithTitle: @"Title
JavaScript display variable in alert
in alert box? I am using javascript.   <html> <head> <script..."; var city = "Delhi"; alert(name +" is in "+ city); } </script> </head> <body> <input type="button" value="Click for Alert" onClick
Servlet
Servlet  What is Servlet
Servlet
Servlet  how to navigate one servlet page to another servlet page
jQuery alert()
jQuery alert() In this jQuery tutorial we will discuss how an alert box works in jQuery. Moreover, this tutorial will discuss in details about alert box in jQuery. In the given application here, alert boxes have been used to provide
Information Save Alert
Information Save Alert  Hi, Sir I am creating a web page there user can edit their information. I want a javascript that can show an alert message when user edit the information and trying to close or go to another page without
servlet
servlet  is there any way to include pdf's in servlet
servlet
servlet  How many times the servlet is accessed
JSP Alert
JSP Alert          JSP Alert is used to put the validation on login... to create alert box in a JSP page. Before applying validation we create a JSP file
ModuleNotFoundError: No module named 'django-alert'
ModuleNotFoundError: No module named 'django-alert'  Hi, My Python... 'django-alert' How to remove the ModuleNotFoundError: No module named 'django-alert' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-alert'
ModuleNotFoundError: No module named 'django-alert'  Hi, My Python... 'django-alert' How to remove the ModuleNotFoundError: No module named 'django-alert' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kotti-alert'
ModuleNotFoundError: No module named 'kotti-alert'  Hi, My Python... 'kotti-alert' How to remove the ModuleNotFoundError: No module named 'kotti-alert' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'omsa-alert'
ModuleNotFoundError: No module named 'omsa-alert'  Hi, My Python... 'omsa-alert' How to remove the ModuleNotFoundError: No module named 'omsa-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'slack-alert'
ModuleNotFoundError: No module named 'slack-alert'  Hi, My Python... 'slack-alert' How to remove the ModuleNotFoundError: No module named 'slack-alert' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'timed-alert'
ModuleNotFoundError: No module named 'timed-alert'  Hi, My Python... 'timed-alert' How to remove the ModuleNotFoundError: No module named 'timed-alert' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'alert-grid'
ModuleNotFoundError: No module named 'alert-grid'  Hi, My Python... 'alert-grid' How to remove the ModuleNotFoundError: No module named 'alert-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'easy-alert'
ModuleNotFoundError: No module named 'easy-alert'  Hi, My Python... 'easy-alert' How to remove the ModuleNotFoundError: No module named 'easy-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'aws-alert'
ModuleNotFoundError: No module named 'aws-alert'  Hi, My Python... 'aws-alert' How to remove the ModuleNotFoundError: No module named 'aws-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-alert'
ModuleNotFoundError: No module named 'django-alert'  Hi, My Python... 'django-alert' How to remove the ModuleNotFoundError: No module named 'django-alert' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-alert'
ModuleNotFoundError: No module named 'django-alert'  Hi, My Python... 'django-alert' How to remove the ModuleNotFoundError: No module named 'django-alert' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mail-alert'
ModuleNotFoundError: No module named 'mail-alert'  Hi, My Python... 'mail-alert' How to remove the ModuleNotFoundError: No module named 'mail-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'nose-alert'
ModuleNotFoundError: No module named 'nose-alert'  Hi, My Python... 'nose-alert' How to remove the ModuleNotFoundError: No module named 'nose-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'rabbitmq-alert'
ModuleNotFoundError: No module named 'rabbitmq-alert'  Hi, My... named 'rabbitmq-alert' How to remove the ModuleNotFoundError: No module named 'rabbitmq-alert' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'supervisor-alert'
ModuleNotFoundError: No module named 'supervisor-alert'  Hi, My... named 'supervisor-alert' How to remove the ModuleNotFoundError: No module named 'supervisor-alert' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'aws-alert'
ModuleNotFoundError: No module named 'aws-alert'  Hi, My Python... 'aws-alert' How to remove the ModuleNotFoundError: No module named 'aws-alert' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-alert'
ModuleNotFoundError: No module named 'django-alert'  Hi, My Python... 'django-alert' How to remove the ModuleNotFoundError: No module named 'django-alert' error? Thanks   Hi, In your python
servlet
servlet  what are the methods and interfaces in the servlet api ?   Servlet Tutorials
Version of com.michaelpardo>materialdesignicons-alert dependency
List of Version of com.michaelpardo>materialdesignicons-alert dependency
servlet
servlet  what are the all necessary configuration to run a servlet
servlet
servlet  how to interact with a servlet from a swing program
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  i want to create a login page with servlet using database mysql? only in servlet not in jsp plzz help me out

Ads