Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012
    Rep Power

    Default Need Help with Register Form(jsp servlet postgresql)

    I am working on creating the register system, I am a new on Java programming, can you guys please check my code, because I don't know why it doesn't work(i run my project from netbeans on glassfish server). After I have fill up the form and press submit I have a page with HTTP Status 404 - and descriptionThe requested resource () is not available.

    <form action="/RegisterServlet" method="post" id="">
    <label for="username">Username</label>
    <input type="text" name="username" id="username" />
    <label for="email">Email Address</label>
    <input type="text" name="email" id="email" />
    <label for="website">Password</label>
    <input type="password" name="password" id="password" />

    <input type="submit" name="register" id="register" value="Register"/>
    <div class="clr"></div>

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

    public class RegisterServlet extends HttpServlet
    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws ServletException,IOException
    PrintWriter out=response.getWriter();
    String name=request.getParameter("username");
    String email=request.getParameter("email");
    String password=request.getParameter("password");
    Connection con=DriverManager.getConnection("jdbc:postgresql://localhost:8088/users","postgres","199326");
    PreparedStatement stmt=con.prepareStatement("insert into users values(?,?,?)");
    stmt.setString(1, name);
    stmt.setString(2, email);
    stmt.setString(3, password);
    int i=stmt.executeUpdate();
    out.println("<b>You are successfully Registered</b>");
    catch(Exception e)
    out.println("<b>Registration failed</b>");
    out.println("<b>Error:</b>" +e);

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Bali, Indonesia
    Rep Power

    Default Re: Need Help with Register Form(jsp servlet postgresql)

    Have you register your RegisterServlet servlet in the web.xml file? and have you define a correct servlet-mapping too?

Similar Threads

  1. simple form & Servlet help
    By bhavinragha in forum Java Servlet
    Replies: 4
    Last Post: 01-27-2012, 07:42 PM
  2. Replies: 0
    Last Post: 10-31-2009, 09:24 AM
  3. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  4. Servlet with a Form/Dropdown
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-16-2008, 10:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts