unable to process the application .cant store user data into the data base,shows only a blank page

servlet code

import java.sql.*;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "register", urlPatterns = {"/register"})
public class Register extends HttpServlet {
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String name=request.getParameter("name");
        String email=request.getParameter("email");
        String pass=request.getParameter("pass");
        try{
            Class.forName("oracle.jdbc.driver.OracleDriver");
            Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","SYSTEM","SYSTEM");
            PreparedStatement ps=con.prepareStatement("insert into Student values(?,?,?)");
            ps.setString(1,name);
            ps.setString(2,email);
            ps.setString(3,pass);
            int i=ps.executeUpdate();
            if(i>0)
            {
                out.println("Successfully registered");
            }
        }catch(Exception se)
        {
            se.printStackTrace();
        }
               }
}

index.html code

<html>
    <head>
        <title>Welcome</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div>oh write content</div>
        <form method="post" action="register">
            Name:<input type="text" name="name"/><br/>
            Email ID:<input type="text" name="email"/><br/>
            Password:<input type="text" name="pass"/><br/>
            <input type="submit" value="register"/>
        </form>
    </body>
</html>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
     version="3.1">
    <servlet>
        <servlet-name>register</servlet-name>
        <servlet-class>Register</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>register</servlet-name>
        <url-pattern>/register</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>
            index.html
        </welcome-file>
    </welcome-file-list>
</web-app>

Im able to open the login form but the application doesn't show 'registration successufll' and the database is also still empty

You have written the code well. Check whether you have added the jar file required. may be this is the problem.

This article has been dead for over six months. Start a new discussion instead.