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("<br>");
out.print("<table align=\"center\" style=\"background-color: white;\"width=\"50%\" border=\"1\">");
out.print("<tr><th>Data Deleted Successfully</th></tr>");
out.print("</table>");
</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
Ads
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
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>
<
Advertisements
Servlet
Servlet how to navigate one
servlet page to another
servlet page
alert in jsp
alert in jsp if(pass.equals(pwd))
{
Statement st1...");
%>
alert("password is successfully changed");
<... Password");
%>
<script>
alert("please enter old Password
servlet
servlet is there any way to include pdf's in
servlet
servlet
servlet what are the methods and interfaces in the
servlet api ?
Servlet Tutorials
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
Servlet
override Service method in the
servlet when you extend GenericServlet to create
servlet as it is mandatory to override it. But, when you extend HttpServlet to create a
servlet then you can't override service method as there is a need to override
servlet
);
}
}
}
this is the code for .java
servlet am able to run...=document.form.pass.value;
if(username==""){
alert("Enter Username!");
return false;
}
if(password==""){
alert("Enter Password!");
return false;
}
return true;
}
<
servlet
servlet i want a program for counting the no of times the
servlet has been invoked
servlet
servlet how to create a login form using
servlet using submit,edit delete button
servlet
servlet dear sir
servlet and html not run on eclips plz help me
servlet
servlet can i stoar record in variable which selected from table in
servlet
servlet
of the
Servlet API. It contains the classes necessary for a standard, protocol-independent
servlet. Every
servlet must implement the
Servlet interface in one
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
Servlet
Servlet I want to know the steps to write a simple
servlet program... .
Hello Friend,
Follow these steps:
Put
servlet-api.jar inside the lib folder of apache tomcat.
1)create a
servlet.
import java.io.*;
import
Servlet
Servlet Can a user defined function be included in a
servlet? I need information regarding
servlet syntax and not JSP.
Yes, you can create user defined function in Servlets.
Have a look at the following link:
http
servlet
servlet I want the full coding for uploading a file in local drive D usin jsp,java class and
servlet... help me thanks in advance....
 ... and
servlet please and thanks in advance
Servlet
Servlet Hi,
Can any one please expalin me below topics
SERVLET ENGINE
2.WHY SUPER.INIT();
Thanks alot in advance!!
Regards:
Akash
servlet
servlet Dear Deepak,
is it compulsary to write the sevice()
becoz i ve seen some example which does not ve sevice()..is it tue? plz replay me
with thanks
praveen
servlet
servlet plz can anyone give me the link of javax library jar file. i badly need that. thanks in advance
Please visit the following link:
Download
Servlet API
servlet
servlet I want a fully readymade project on online voting system with code in java
servlet and database backend as msaccess.can u plz send me as soon as possible
Servlet
the same error
<web-app>
<servlet>
<
servlet-name>InsertServlet</
servlet-name>
<
servlet-class>InsertServlet</
servlet-class>
</servlet>
<
servlet-mapping>
<
servlet-name>
SERVLET
to the
servlet and if the user id is correct then a new page will be displayed with his... pass to the
servlet and all the fields brlongs to that id will be appear... will be done by using jsp and
servlet... Plz help me,im really tensed...........
 
servlet
servlet hi sir,this is ashok.i installed tomcat 6.0 and jdk-150.i checked the server it's working but when execute
servlet program for the .class file it shows the errors javax.servlet is not exist.what can i do,please tell me
servlet
servlet How do we define an application level scope for
servlet?
Application scope uses a single namespace, which means all your pages should be careful not to duplicate the names of application scope objects
SERVLET
to give an
alert message when I try to submit the form. Employee id is a primary