jsp-servelet,error http404

jsp-servelet,error http404

I am using mysql commandclient to connect with eclipse using jsp and servelet. I keep getting the error hhtp 404. Register.jsp

Name:<input type="text" name="userName"/><br/><br/>
Password:<input type="password" name="userPass"/><br/><br/>
Email Id:<input type="text" name="userEmail"/><br/><br/>
Country:
<select name="userCountry">
<option>India</option>
<option>Pakistan</option>
<option>other</option>
</select>

<br/><br/>
<input type="submit" value="register"/>

</form>
</body>
</html>
Register.java
package user;

import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;

public class Register extends HttpServlet {
    private static final long serialVersionUID = 1L;
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

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

        String n=request.getParameter("userName");
        String p=request.getParameter("userPass");
        String e=request.getParameter("userEmail");
        String c=request.getParameter("userCountry");

        try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con=DriverManager.getConnection("jdbc:mysql://localhost/registerclient?user=root&password=hemaswa");
        PreparedStatement ps=con.prepareStatement("insert into user values(?,?,?,?)");
        ps.setString(1,n);
        ps.setString(2,p);
        ps.setString(3,e);
        ps.setString(4,c);

        int i=ps.executeUpdate();
        if(i>0)
        out.print("You are successfully registered...");


        }catch (Exception e2) {System.out.println(e2);}

        out.close();
    }

}

Please help

View Answers









Related Tutorials/Questions & Answers:
jsp-servelet,error http404
jsp-servelet,error http404  I am using mysql commandclient to connect with eclipse using jsp and servelet. I keep getting the error hhtp 404. Register.jsp Name:<input type="text" name="userName"/><

Ads