<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

</head>
<body bgcolor=bisque>




<%@page language="java" import="java.util.*,java.sql.*,javax.swing.* ,java.lang.* " contentType="text/html"%>
<jsp:include page="menu.jsp"></jsp:include><html>

<%
	       String a=request.getParameter("eid");
               String b=request.getParameter("ename");
               int c=Integer.parseInt(request.getParameter("esal"));
               String d=request.getParameter("ediv");
               String e1=request.getParameter("etid");
               int f=Integer.parseInt(request.getParameter("emarks"));
               int g=Integer.parseInt(request.getParameter("eper"));
               String h=request.getParameter("ecgrade");
               String i=request.getParameter("epgrade");
               int j=Integer.parseInt(request.getParameter("exp"));

               try
              {
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

               Connection con=DriverManager.getConnection("jdbc:odbc:sree","sree","sree");
               PreparedStatement pstmt = con.prepareStatement("insert into emp values(?,?,?,?,?,?,?,?,?,?)");
              pstmt.setString(1, a);
              pstmt.setString(2, b);
              pstmt.setInt(3, c);
              pstmt.setString(4,d);
              pstmt.setString(5,e1);
              pstmt.setInt(6,f);
              pstmt.setInt(7,g);
              pstmt.setString(8,h);
              pstmt.setString(9,i);
              pstmt.setInt(10,j);

              int x=pstmt.executeUpdate();
              if(x==1)
                  {
                 request.setAttribute("sri","The emp details were successfully inserted" );

                  //request.setAttribute("x" , "The insertion was failed");
                  RequestDispatcher dispatch=request.getRequestDispatcher("empinsert.jsp");
                  dispatch.forward(request,response);
              }
              else
                {
                  request.setAttribute("sri","The emp details were not inserted" );

                  //request.setAttribute("x" , "The insertion was failed");
                  RequestDispatcher dispatch=request.getRequestDispatcher("empinsert.jsp");
                  dispatch.forward(request,response);
                }

            }
catch(SQLException e)
{
    out.println(e);

}

%>

</body>
</html>