index.html
-----------------------------------------
UpdateEmp.jsp
<%@page contentType="text/html" import="java.sql.*"%>
Employee Record Update
<%
String eno=request.getParameter("txtEno");
String eno=request.getParameter("txtEno");
String eno=request.getParameter("txtEno");
String eno=request.getParameter("txtEno");
try{
//Class.forName();
Connection con=DriverManager.getConnection();
PreparedStatement stmt=con.prepareStatement("select * from emp where empid=?");
stmt.setString(1,eno);
ResultSet rs=stmt.executeQuery();
if (rs.next()){
out.println(" --------------- Employee "+name+"Exist -----------------
");
PreparedStatement pst1=con.prepareStatement("update emp set salary=? where empid=?");
PreparedStatement pst2=con.prepareStatement("update emp set age=? where empid=?");
pst1.setString(1,sal);pst1.setString(2,eno);
pst2.setString(1,sal);pst2.setString(2,eno);
pst1.executeUpdate();
pst2.executeUpdate();
}
else
{
out.println(" Employee Record does not exists !!!!! ");
}
catch(Exception e){ out.println(e);}
%>