<%@ page language="java" contentType="text/html" import="java.sql.*,java.text.*,java.util.*" %>

    <%!
          Connection con;
         java.sql.Statement st;
         java.sql.PreparedStatement ps;
          java.sql.ResultSet rs;
          SimpleDateFormat sdf;
          
          String dcn1="oracle.jdbc.driver.OracleDriver";
          String url="jdbc:oracle:thin:@localhost:1521:XE";
          String uname="lettertracker";
          String pw="mechanical";
          %>
          
          <% try
          {
          String serial=request.getParameter("serial");
          String lno=request.getParameter("lno");
         String letterdate=request.getParameter("letterdate");
         String receivedfrom=request.getParameter("receivedfrom");
         String subject=request.getParameter("subject");
         String status=request.getParameter("status");
         String remainder=request.getParameter("remainder");
          sdf=new SimpleDateFormat("dd-MM-yyyy");
          
          String ed=request.getParameter("entrydate");
            java.util.Date date=sdf.parse(ed,new java.text.ParsePosition(0));
           Timestamp entrydate=new Timestamp(date.getTime());
         
          /*String et=request.getParameter("entrytime");
            Date time=sdf.parse(et,new ParsePosition(0));
           Timestamp entrytime=new Timestamp(time.getTime());
           */
           
           String markedto=request.getParameter("markedto");
         String query="insert into i_local_tappal values(?,?,?,?,?,?,?,?,?,?)";
          Class.forName(dcn1);
          con=DriverManager.getConnection(url,uname,pw);
          ps=con.prepareStatement(query);
          ps.setString(1,serial);
          ps.setString(2,lno);
          ps.setString(3,letterdate);
          ps.setString(4,receivedfrom);
          ps.setString(5,subject);
          ps.setString(6,status);
          ps.setString(7,remainder);
          ps.setString(8,entrydate);
          ps.setString(9,entrytime);
          ps.setString(10,markedto);
            int i=ps.executeUpdate();
         out.println(i);
          }
          
          catch(Exception e)
                  {
              out.println(e);
              }
          %>
         
      
        












