<repo_name>Zain517/java-s_FianalProject<file_sep>/finalproject/WEB-INF/classes/neworder.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import javax.swing.*;


public class neworder extends HttpServlet {
  
  //Process the HTTP Get request
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
    HttpSession session=request.getSession(false);
    if(session==null)
    {RequestDispatcher rd=request.getRequestDispatcher("login.html");
    rd.forward(request, response);}

    String sid=(String)session.getAttribute("type");
    System.out.println(sid);
   if( sid.equals("0"))
   {RequestDispatcher rd=request.getRequestDispatcher("login.html");
    rd.forward(request, response);}


	response.setContentType("text/html");
    
	// get PrintWriter object
	PrintWriter out = response.getWriter();

   //cvalidate.......

  out.println("<html>");  
  out.println("<head>"); 
  out.println("<title> Add Order</title>"); 
  out.println("<script language=\"JavaScript\" type=\"text/javaScript\">  "); 
  out.println("function cvalidate(){if ( document.cf.rid.value == \"\" ){"); 
  out.println("var errors=\"Customer's ID is empty!!\";"); 
  out.println("document.getElementById(\"rid\").innerHTML=errors;		document.cf.rid.focus();"); 
  out.println("return false;}"); 
  out.println("if ( document.cf.fn.value == \"\" ){"); 
  out.println("var errors=\"First name is empty!!\";"); 
  out.println("document.getElementById(\"fn\").innerHTML=errors;"); 
  out.println("document.cf.fn.focus();return false;}"); 
  out.println("if ( document.cf.ln.value == \"\" ) {var errors=\"Last name is empty!!\";"); 
  out.println("document.getElementById(\"ln\").innerHTML=errors;"); 
  out.println("document.cf.ln.focus();return false;}"); 
  out.println("return true;}"); 


//validate......

  out.println("function validate(){if ( document.f.id.value == \"\" ){"); 
  out.println("var errors=\"Order's ID is empty!!\";   "); 
  out.println("document.getElementById(\"ID\").innerHTML=errors;"); 
  out.println("document.f.id.focus();return false; }  "); 
  out.println("if ( document.f.na.value == \"\" ){var errors=\"Customer's name is empty!!\";document.getElementById(\"name\").innerHTML=errors;"); 
  out.println("document.f.na.focus();return false; }"); 
  out.println("if ( document.f.sq.value == \"\" ){var errors=\"Quantity is empty!!\";"); 
  out.println("document.getElementById(\"sq\").innerHTML=errors;"); 
  out.println("document.f.sq.focus();return false;}  "); 
  out.println("var mail=document.forms['f']['sq'].value;");
  out.println("if(mail>=99 ){var errors=\"Too much Suit(s) Quantity [1-99].....!!\";document.getElementById(\"co\").innerHTML=errors;document.f.sq.focus();return false; }");
  out.println("if ( document.f.co.value == \"\" ){var errors=\"Color-Desc is empty!!\";document.getElementById(\"co\").innerHTML=errors; document.f.co.focus();return false;}");   
  out.println("if(mail<='0' ){var errors=\"In_Valid Suit(s) Quantity[1-99].....!!\";document.getElementById(\"co\").innerHTML=errors;document.f.sq.focus();return false; }"); 
  out.println("if ( document.f.dt.value == \"\" ){var errors=\"Design-type is empty!!\";document.getElementById(\"dt\").innerHTML=errors;document.f.dt.focus();return false;}"); 
  out.println("if((document.f.subDate.value) > (document.f.deliDate.value)) "); 
  out.println(" {var errors=\"Submission Date always less than delivery date!!\";document.getElementById(\"date\").innerHTML=errors;return false;}"); 
  out.println("return true;}"); 


//letternumber.....


  out.println("function letternumber(event){		var keychar;keychar = event.key;	if (((\".+-0123456789\").indexOf(keychar) > -1)) return true; if (event.keyCode === 13){ event.preventDefault();document.getElementById(\"order\").click();}else{	alert(\" Should only Numerics.....!!\");			return false;	}}"); 
 
 
 //nameVelidation....


  out.println("function nameVelidation(event)	{	var keychar;	keychar = event.key;	if (((\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \").indexOf(keychar) > -1)) return true;  if (event.keyCode === 13){ event.preventDefault();document.getElementById(\"order\").click();}  else{alert(\"Special & numeric charaters not Allowed...!!\");	return false;	}	}"); 
 
 
  out.println("</script> "); 
  //ScriptEnd.....

  out.println("<style>"); 
  out.println(".button{"); 
  out.println("background-color:blue;"); 
  out.println("	border:2px solid #white;"); 
  out.println("opacity:0.80;"); 
  out.println("	border-radius:1px;"); 
  out.println("width:105px;"); 
  out.println("height:35px;"); 
  out.println("color:white;"); 
  out.println("transition:0.5s;"); 
  out.println("transition:0.5s;}"); 
  out.println("</style>"); 


  out.println("</head> <body>");
  //Header End Body Start from here....
  
  
//

  out.println("<div>");  //main div

  out.println("<div style=\" float:right;\"> "); //right div
  out.println("<fieldset style=\"width:65px; margin-right:200px;\">  "); 
  out.println("<legend><h1><b><i>( New Order's Details  ) </i></b></h1></legend>  "); 
  out.println("<form name=\"f\"   action=\"generatereceipt\"   method=\"post\"     onsubmit=\"return validate()\" >  "); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"New Order ID  \" name=\"id\" onKeyPress=\"return letternumber(event)\">  <div id=\"ID\" style=\"color:red\"></div>"); 
  out.println("<br>"); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Customer Name  \" name=\"na\" onKeyPress=\"return nameVelidation(event)\">  <div id=\"name\" style=\"color:red\"></div>"); 
  out.println("<br>"); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Suit(s) Quantity  \" name=\"sq\" onKeyPress=\"return letternumber(event)\">  <div id=\"sq\" style=\"color:red\"></div>"); 
  out.println("<br>"); 
  //out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Colors-Description  \" name=\"co\" >  <div id=\"co\" style=\"color:red\"></div>"); 
  out.println("<textarea name=\"co\" rows=\"3\" cols=\"48\" placeholder=\"Colors- Description......\"></textarea>  <div id=\"co\" style=\"color:red\"></div> ");
  out.println("<br>"); 
 // out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Design-type /Style \" name=\"dt\">  <div id=\"dt\" style=\"color:red\"></div>"); 
 out.println("<textarea name=\"dt\" rows=\"3\" cols=\"48\" placeholder=\"Design-Type......\"></textarea>  <div id=\"dt\" style=\"color:red\"></div> "); 
 out.println("<br>"); 
  out.println("<strong> Submit Date:       &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;   Delivery Date:</strong><br>  "); 
  out.println("<input type=\"date\" name=\"subDate\" value=\"2020-01-01\">&emsp;&emsp;&emsp;  "); 
  out.println("<input type=\"date\" name=\"deliDate\" value=\"2020-01-07\"> "); 
  out.println("<div id=\"date\" style=\"color:red\"></div>  "); 
  out.println("<br><br>"); 
  out.println("<textarea name=\"t\" rows=\"5\" cols=\"48\" placeholder=\" Description......\"></textarea>  "); 
  out.println("<br><br>"); 
  out.println("<input style=float:right; class=\"button\" type=\"submit\"   id=\"order\"  value=\"Add Order\" />  "); 
  out.println("</form> </fieldset> </div> "); 

//right div end


  out.println("<div style=\"float:left;\">"); //left div start
  out.println("<fieldset style=\"width:65px; margin-left:100px;\">  "); 
  out.println("<legend><h1><b><i>( Customer's Details  ) </i></b></h1></legend>  "); 
  out.println("<form name=\"cf\" action=\"customersearch\" method=\"post\" onsubmit=\"return cvalidate()\" >  "); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Registered Customer ID  \" name=\"rid\" onKeyPress=\"return letternumber(event)\">  "); 
  out.println("<div id=\"rid\" style=\"color:red\"></div>  "); 
  out.println("<br>"); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"<NAME>  \" name=\"fn\" onKeyPress=\"return nameVelidation(event)\"> <div id=\"fn\" style=\"color:red\"></div>"); 
  out.println("<br>"); 
  out.println("<input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"<NAME>  \" name=\"ln\" onKeyPress=\"return nameVelidation(event)\">  <div id=\"ln\" style=\"color:red\"></div>"); 
  out.println("<br>"); 
  out.println("<input style=float:right; class=\"button\" type=\"submit\" id=\"search\" value=\"Search \" />  "); 
  out.println("</form> </fieldset> <br>"); 


  out.println("<div>"); //left down div
  //out.println("<fieldset style=\"width:350px; height:250px; margin-left:100px;\">  "); 



  String s=(String)request.getAttribute("status");


///////Search Result

    if(s.equals("1")){

    out.println("<fieldset style=\"width:350px;  margin-left:100px;\">  "); 

    int id=(Integer)request.getAttribute("cid");
    String fn=(String)request.getAttribute("fn");
    String ln=(String)request.getAttribute("ln");
    String mb=(String)request.getAttribute("mb");
    String add=(String)request.getAttribute("add");
    double kl=(Double)request.getAttribute("kl");
    double al=(Double)request.getAttribute("al");
    double sh=(Double)request.getAttribute("sh");
    double ch=(Double)request.getAttribute("ch");
    double co=(Double)request.getAttribute("co");
    double fi=(Double)request.getAttribute("fi");
    double tl=(Double)request.getAttribute("tl");
    double bo=(Double)request.getAttribute("bo");
    String po=(String)request.getAttribute("po");
    String da=(String)request.getAttribute("da");


    out.println("<h1 style=\"color:green;\">Record found...</h1>");
    out.println("<strong>Customer ID:</strong> " +id+" ");out.println("<br>"); 
    out.println("<strong>First Name:</strong> " +fn+" ");out.println("<br>"); 
    out.println("<strong>Last Name:</strong> " +ln+" ");out.println("<br>"); 
    out.println("<strong>Mobile#:</strong> " +mb+" ");out.println("<br>"); 
    out.println("<strong>Address:</strong> " +add+" ");out.println("<br>"); 
    out.println("<strong>Kameez Length:</strong> " +kl+ " inches ");out.println("<br>"); 
    out.println("<strong>Arm Length:</strong> " +al+ " inches ");out.println("<br>"); 
    out.println("<strong>Shoulder:</strong> " +sh+ " inches ");out.println("<br>"); 
    out.println("<strong>Chest:</strong> " +ch+ " inches ");out.println("<br>"); 
    out.println("<strong>Collar:</strong> " +co+ " inches ");out.println("<br>"); 
    out.println("<strong>Fitting:</strong> " +fi+ " inches ");out.println("<br>"); 
    out.println("<strong>Trouser Length:</strong> " +tl+ " inches ");out.println("<br>"); 
    out.println("<strong>Narrow Bottom:</strong> " +bo+ " inches ");out.println("<br>"); 
    out.println("<strong>Pockects:</strong> " +po+" ");out.println("<br>"); 
    out.println("<strong>Daman Style:</strong> " +da+" ");out.println("<br>");
    out.println("<br>");




    
    out.println("<form name=\"uf\" action=\"edit\" method=\"post\"  >  ");
    out.println("<input style=float:right; class=\"button\" type=submit value=update>");

    out.println("</form>");
    


      
    out.println("<form name=\"uf\" action=\"remove\" method=\"post\"  >  ");
    out.println("<input style=float:right; class=\"button\" type=submit value=Delete>");
    out.println("</form>");
  }


//////Search Invalid


    if(s.equals("0"))
    {
    out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");

    String n=(String)request.getAttribute("error");
    out.println("<h1 style=\"color:red;\">  Record not found..  </h1><br>");

      
    out.println("<form name=\"uf\" action=\"newcustomer\" method=\"post\"  >  ");
    out.println("<input style=float:right;width:150px; class=\"button\" type=submit value=\"Add new Customer\">");
    out.println("</form>");

    }
    


    ////Record Update
    if(s.equals("true")){
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:green;\"> Record Updated...</h1><br>");
      
    }
    ////not Update Record
    if(s.equals("false")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Updation Error...  </h1><br>");
     
    }


    ////Delete
    if(s.equals("delete")){
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:green;\"> Record Deleted...</h1><br>");
      
    }
    ///Not Delete Record
    if(s.equals("not delete")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Deletion Error...  </h1><br>");
     
    }


    ////already present
    if(s.equals("found")){
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Already in Record...</h1><br>");    
      out.println("<strong> Customer ID already taken, Please change it...</strong><br>");
   
    }
    ///inserted
    if(s.equals("added")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:green;\">  Insert Successfully...  </h1><br>");
     
    }
    ///not Inserted
    if(s.equals("not added")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Insertion Error ...  </h1><br>");
     
    }

////order founded....
    if(s.equals("order found")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:green;\">  Order Already Present...  </h1><br>");
      out.println("<strong> Order ID already taken, Please change it...</strong><br>");
   
    }
    ///Order not Inserted
    if(s.equals("order not added")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Order Insertion Error ...  </h1><br>");
     
    }

    //invalid order ID input by jOptionPane.....
    if(s.equals("order false")){
      
      out.println("<fieldset style=\"width:350px; margin-left:100px;\">  ");
      out.println("<h1 style=\"color:red;\"> Invalid Order ID ...  </h1><br>");
      out.println("<strong> Please enter Valid Order ID...</strong><br>");

     
    }



  out.println("</fieldset> </div> "); //left down div
  out.println("</div>"); //left div
  out.println("</div>"); //main div
  
  out.println("</body></html>");
  






   
   

    

  }
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);
  }

}
<file_sep>/finalproject/WEB-INF/classes/update.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class update extends HttpServlet{

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException
{
  HttpSession session=request.getSession(false);
  if(session==null) 
  {response.sendRedirect("login.html");}
  else{
  
   String id=(String)session.getAttribute("c_searchId");
   //String fname=(String)request.getAttribute("c_searchname");

  System.out.println(id);

    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    // Cookie c[]=request.getCookies();
    
    // //for(int i=0;i<c.length;i++){
    //     String fname=c[0].getName();
    //     String id=c[0].getValue();

        

        try{
            Class.forName("com.mysql.jdbc.Driver");
        
            String url = "jdbc:mysql://127.0.0.1/darzikhana";
        
            Connection con=DriverManager.getConnection(url,"root","zain4744");
        
            Statement st=con.createStatement();
            
             String query="Select * from customerdetails where customerId="+id+"   ";
           
             ResultSet rs = st.executeQuery( query );
           
             
             if(rs.next()){
              
                //out.println("<h1>Record found</h1>");
        
                    int cid = rs.getInt("customerId");
                    String fn = rs.getString("firstName");
                    String ln = rs.getString("lastName");
                    String mb = rs.getString("mobileNumber");
                     String add = rs.getString("address");
                    // System.out.println(add);
                    double kl = rs.getDouble("kameezLength");
                    double al = rs.getDouble("armLength");
                    double sh = rs.getDouble("shoulder");
                    double ch = rs.getDouble("chest");
                    double co = rs.getDouble("collar");
                    double fi = rs.getDouble("fitting");
                    double tl = rs.getDouble("trouserLength");
                    double bo = rs.getDouble("bottomOpenning");
                    String po = rs.getString("pocket");
                    String da = rs.getString("daman");
                    System.out.println(po);
        
               





      // out.println("Welcome " + name+"<br>Your password is "+password+"<br>");
    //}    
    


      out.println("<html> <head> <title> Update Customer</title>");
      out.println("<script language=\"JavaScript\" type=\"text/javaScript\">      ");
      out.println("function validate(){	");
      out.println("if ( document.f.mb.value == \"\" ) {var errors=\"Mobile no. is empty!!\"; document.getElementById(\"mobile\").innerHTML=errors;document.f.mb.focus(); return false; } ");
      out.println("var mail=document.forms['f']['mb'].value;");
      out.println("if(mail.length<11 || mail.length>15 ) { var errors=\"In_Valid (minimum 11 digits).....!!\";document.getElementById(\"mobile\").innerHTML=errors;document.f.mb.focus();return false; }");
      out.println("if ( document.f.add.value == \"\" ){ var errors=\"Address is empty!!\"; document.getElementById(\"address\").innerHTML=errors;document.f.add.focus(); return false;}");
      out.println("if ( document.f.kl.value == \"\" ) { var errors=\"kameez-Length is Empty...!!\";document.getElementById(\"kl\").innerHTML=errors;document.f.kl.focus();return false; }");
      out.println("if ( document.f.al.value == \"\" ){var errors=\"Arm-Length is Empty...!!\"; document.getElementById(\"al\").innerHTML=errors;document.f.al.focus(); return false; }");
      out.println("if ( document.f.sh.value == \"\" ){var errors=\"Shoulder-Length is Empty...!!\";document.getElementById(\"sh\").innerHTML=errors;document.f.sh.focus();return false; }");
      out.println("if ( document.f.ch.value == \"\" ){var errors=\"Chest-Length is Empty...!!\";document.getElementById(\"ch\").innerHTML=errors;document.f.ch.focus();return false;}");
      out.println("if ( document.f.co.value == \"\" ){var errors=\"Collar-Length is Empty...!!\";document.getElementById(\"co\").innerHTML=errors;document.f.co.focus(); return false; }");
      out.println("if ( document.f.fi.value == \"\" ) { var errors=\"Fitting-Length is Empty...!!\";document.getElementById(\"fi\").innerHTML=errors;document.f.fi.focus();return false;}");
      out.println("if ( document.f.tl.value == \"\" ){var errors=\"Trouser-Length is Empty...!!\"; document.getElementById(\"tl\").innerHTML=errors;document.f.tl.focus(); return false;}");
      out.println("if ( document.f.bo.value == \"\" ){ var errors=\"Bottom-Opening-Length is Empty...!!\";document.getElementById(\"bo\").innerHTML=errors;document.f.bo.focus(); return false;}");
      out.println("if ( document.f.po.value == \"\" ){var errors=\"Number of Pockets are Empty...!!\";document.getElementById(\"po\").innerHTML=errors;document.f.po.focus(); return false; }");
      out.println("return true;}");
      
      
      //letternumber.....


  out.println("function letternumber(event){		var keychar;keychar = event.key;	if (((\".+-0123456789\").indexOf(keychar) > -1)) return true; if (event.keyCode === 13){ event.preventDefault();document.getElementById(\"order\").click();}else{	alert(\" Should only Numerics.....!!\");			return false;	}}"); 
 
 
  //nameVelidation....
 
 
   out.println("function nameVelidation(event)	{	var keychar;	keychar = event.key;	if (((\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \").indexOf(keychar) > -1)) return true;  if (event.keyCode === 13){ event.preventDefault();document.getElementById(\"order\").click();}  else{alert(\"Special & numeric charaters not Allowed...!!\");	return false;	}	}"); 
  
  
   out.println("</script> "); 
   //ScriptEnd.....


   
  out.println("<style>"); 
  out.println(".button{"); 
  out.println("background-color:blue;"); 
  out.println("	border:2px solid #white;"); 
  out.println("opacity:0.80;"); 
  out.println("	border-radius:1px;"); 
  out.println("width:150px;"); 
  out.println("height:35px;"); 
  out.println("color:white;"); 
  out.println("transition:0.5s;"); 
  out.println("transition:0.5s;}"); 
  out.println("</style>"); 


  out.println("</head> <body>");
  //Header End Body Start from here....
  
  

      out.println("<div > <fieldset style=\"width:480px; margin-left:500px;\">      ");
      out.println("<form name=\"f\" action=\"finalupdate\" method=\"post\" onsubmit=\"return validate()\" >      ");
      out.println("<h1><b>Update Customer's Details </b></h1><br>");
     
      out.println("<strong>Mobile# : </strong><input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Mobile Number  \"  value=" + mb+" name=\"mb\" onKeyPress=\"return letternumber(event)\"><div id=\"mobile\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Address : </strong><input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Address  \"  value=\"   " + add+ "    \"  name=\"add\"><div id=\"address\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<h1><b>Customer's Measurements<sup> (inches)</sup></b></h1>      ");
      out.println("<br>");
      out.println("<strong>Kameez Length : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Kameez-Length  \"    value=" + kl+"  name=\"kl\" onKeyPress=\"return letternumber(event)\">  <div id=\"kl\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Arm Length : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Arm-Length  \"  value=" + al+" name=\"al\" onKeyPress=\"return letternumber(event)\"> <div id=\"al\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Shoulder : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Shoulder  \"  value=" + sh+" name=\"sh\" onKeyPress=\"return letternumber(event)\"> <div id=\"sh\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Chest : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Chest  \"   value=" +ch+"  name=\"ch\" onKeyPress=\"return letternumber(event)\"> <div id=\"ch\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Collar : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Collar \"  value=" + co+" name=\"co\" onKeyPress=\"return letternumber(event)\"> <div id=\"co\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Fitting : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Fitting  \"  value=" + fi+" name=\"fi\" onKeyPress=\"return letternumber(event)\"> <div id=\"fi\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Trouser Length : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Trouser-Length  \"    value=" + tl+" name=\"tl\" onKeyPress=\"return letternumber(event)\"> <div id=\"tl\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Bottom Openning : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Bottom-Opening  \"  value=" + bo+" name=\"bo\" onKeyPress=\"return letternumber(event)\"> <div id=\"bo\" style=\"color:red\"></div>");
      out.println("<br>");
      out.println("<strong>Pockets : </strong><input style=\"width:150px;padding:10px;\"  type=\"text\"  placeholder=\"Pockets \"   value=\" "+ po+"  \" name=\"po\" > <div id=\"po\" style=\"color:red\"></div>");
      out.println("<br><strong> Daman : </strong>");
      out.println("<select name=Daman : ><option value=\"square\">Square</option> <option value=\"circle\">Circular</option></select>");
      out.println("<br>");
      out.println("<input style=float:right; class=\"button\" type=\"submit\" id=\"order\" value=\"Update Customer\" />      ");
      out.println("</form>");
      out.println("</fieldset></div>");



      
     // String s=(String)request.getAttribute("status");
     

        
      out.println(" </div></body> </html> ");
        




   
    }
    
    else{
     //out.println("else");
     
    //  out.println(i);
     String err="No record found........";
     
    } 
        //out.println("</body></html>");
        st.close();
        con.close();

 }catch(Exception e){

   out.println(" ");
 }

  

   
    
        

}
}

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  doPost(request,response);
}
}<file_sep>/finalproject/WEB-INF/classes/Search.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;


public class Search extends HttpServlet {

  //Process the HTTP Get request
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   
    
    
    PrintWriter out = response.getWriter();

    String u_name=request.getParameter("n");
    String pwd=request.getParameter("p");
    System.out.println(u_name);
    


    try{
    Class.forName("com.mysql.jdbc.Driver");

    String url = "jdbc:mysql://127.0.0.1/darzikhana";

    Connection con=DriverManager.getConnection(url,"root","zain4744");

    Statement st=con.createStatement();
    
     String query="Select * from login where username='"+u_name+"' AND  password='"+pwd+"' ";
   
     ResultSet rs = st.executeQuery( query );
   
     if(rs.next()){

        String name = rs.getString("username");
        String pass = rs.getString("password");
        String type = rs.getString("type");

        HttpSession session = request.getSession(true);
        session.setAttribute("username", name);
        session.setAttribute("password", <PASSWORD>);
        session.setAttribute("type", type);

          if(type.equals("1"))
          {
            RequestDispatcher rd=request.getRequestDispatcher("/home");
                 rd.forward(request, response);
          }
          if(type.equals("0"))
          {
            RequestDispatcher rd=request.getRequestDispatcher("extra.html");
                 rd.forward(request, response);
          }
    	    

	  }
     
     else{
            out.println(" <html> <head> <title> login</title> <script language=\"JavaScript\" type=\"text/javaScript\">     function validate()       ");
            out.println(" {	if ( document.f.n.value == \"\" ){var errors=\"Username is empty!!\";      document.getElementById(\"name\").innerHTML=errors;  document.f.n.focus();return false; }            ");
            out.println(" if(document.f.p.value == \"\")	{var errors=\"password is empty!!\";        document.getElementById(\"p\").innerHTML=errors;      document.f.p.focus();return false;}	            ");
            out.println(" return true;}  ");
            out.println(" function fun(){alert(\"Username Password Error\");}");
            out.println("</script><style>"); 
            out.println(".button{"); 
            out.println("background-color:blue;"); 
            out.println("	border:2px solid #white;"); 
            out.println("opacity:0.80;"); 
            out.println("	border-radius:1px;"); 
            out.println("width:105px;"); 
            out.println("height:35px;"); 
            out.println("color:white;"); 
            out.println("transition:0.5s;"); 
            out.println("transition:0.5s;}"); 
            out.println("</style> </head> "); 
            out.println(" <body onload=\"fun()\"> ");
            out.println(" <fieldset style=\"width:440px; margin-left:500px;\">             ");
            out.println(" <h1><b>Welcome the Darzi-Khana</b></h1>    <br>         ");
            out.println(" <form name=\"f\" action=\"Search\" method=\"post\" onsubmit=\"return validate()\" >     <br>");
            out.println(" <input style=\"width:350px;padding:10px;\"  type=\"text\"  placeholder=\"Username  \" name=\"n\">            ");
            out.println("<div id=\"name\" style=\"color:red\"></div>   <br>         ");
            out.println(" <input type=\"password\" style=padding:10px; placeholder=\"Password\" name=\"p\"><div id=\"p\" style=\"color:red\"></div>            ");
            out.println(" <input style=float:right; class=\"button\" type=\"submit\" value=\"Next\" />            ");
            out.println(" </form> </fieldset> ");
            out.println(" </body> ");
            out.println(" </html>");
          

          }



           st.close();
           con.close();

    }catch(Exception e){

      out.println(" ");
    }

  }

  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);}

}
<file_sep>/finalproject/WEB-INF/classes/logout.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import javax.swing.*;

public class logout extends HttpServlet{

public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException
{
  HttpSession session=request.getSession(false);
  if(session==null) 
 {response.sendRedirect("login.html");}

 else{ 

    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    session.invalidate();
    response.sendRedirect("login.html");
}
}

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  doPost(request,response);
}

}