Heading

Wednesday, March 5, 2014

Web Application in Java with JDBC, Servlets, JSp and MYSQL DataBase-5

Registration.java:


import java.io.*;
   import java.sql.*;
   import javax.servlet.*;
   import javax.servlet.http.*;
   public class Registration extends HttpServlet {
    Connection con=null;
    Statement st=null;
    ResultSet rs=null;
    RequestDispatcher rd=null;
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException {
    String userid= req.getParameter("userid");
        String passid= req.getParameter("passid");
        String username= req.getParameter("username");
    String email= req.getParameter("email");
        String mob= req.getParameter("mob");
        System.out.println(mob+" "+ userid+" "+passid+" "+username+" "+email);

    RequestDispatcher rd;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee","root","password");
            st = con.createStatement();
             System.out.println(con);      
             int add=st.executeUpdate("insert into userlogin values('"+userid+"','"+passid+"','"+username+"','"+email+"','"+mob+"')");
          System.out.println(add);
          res.sendRedirect("Register_Page.jsp?Message=success");
         
           // rd=req.getRequestDispatcher("Login_Page.jsp");
          //rd.forward(req,res);
        } catch(Exception e2) {
             rd=req.getRequestDispatcher("Register_Page.jsp");
        }
    }
}

1 comment:

  1. Cheap payday loans hurt your pocket too do not have a good credit score and also do not help these people. They even come cheap, expensive, however, payday loans, should be made a habit. If payday loans uk For You For more information about payday loans, Know
    Youve seen the ads and heard the stories. Now, to meet emergency expenses yourself in need of extra money. Do you have instant 3 month payday loans the best solution for you? We on these types of loans and temporary cash to help solve the problems you need to open them you need to know whether we will examine.
    What are instant payday loans?
    If you are familiar with cash advance, instant 3 month loans then you have no idea what. These typically from $ 100 to $ 1,000, ranging is present in small amounts are unsecured loans. You deserve some credit in particular, offer more.
    If they are unsecured, I guarantee what do you use?

    For more info :-
    http://payday3monthloans24hrs.co.uk
    http://3monthpaydayloansanytime.co.uk
    http://3monthloanstopocket6uk.co.uk

    ReplyDelete