<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link href="css/sty.css" rel="stylesheet" type="text/css"></link>        
</head>
<body>
<%@page language="java" import="java.text.*,java.util.*,java.sql.*" contentType="text/html"%>

<%
		 String sendto=request.getParameter("sendto");
          boolean b=false;
		      SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy");
		   try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con=DriverManager.getConnection("jdbc:odbc:letter");
                  PreparedStatement pstmt2 = con.prepareStatement("select * from o_tappals where sendto='"+sendto+"'");


 ResultSet rs2= pstmt2.executeQuery();
	
		   while(rs2.next())
            {
       
 out.println("<center><table cellspacing=10 cellpadding=5>");

out.println("<tr><td>SerialNo</td><td>"+rs2.getString(1)+"</td></tr>");
out.println("<tr><td>LetterNo</td><td>"+rs2.getString(2)+"</td></tr>");
Timestamp tsp4=rs2.getTimestamp(3);
        java.util.Date d4=new java.util.Date(tsp4.getTime());
	 String d13=sdf.format(d4);
out.println("<tr><td>EntryDate</td><td>"+d13+"</td></tr>");
b=true;
out.println("<tr><td>EntryTime</td><td>"+rs2.getString(4)+"</td></tr>");
out.println("<tr><td>Subject</td><td>"+rs2.getString(5)+"</td></tr>");
out.println("<tr><td>SendTo</td><td>"+rs2.getString(6)+"</td></tr>");
out.println("<tr><td>LetterName</td><td>"+rs2.getString(7)+"</td></tr>");
out.println("<tr><td>Demiofficial</td><td>"+rs2.getString(8)+"</td></tr>");
out.println("</table></center>");
out.println("<hr>");

			
			}
  
			      
		   
		   
if(!b)
			   {
	  request.setAttribute("error","Not Found ");
                   RequestDispatcher rd=request.getRequestDispatcher("rsendto.jsp");
                rd.forward(request, response);
		
		
                
			   }
		   
		   
		   
		   
		   
		   
		   
		   con.close();
		   
		   
		   
		   
		   }


catch(ClassNotFoundException s)
        { 
	out.println("loaderror");
   	}
		catch(SQLException e)
        { 
	out.println("sqlerror");
   }
%>
</body>
</html>