thanks Bear below are the NPE and DAO code
The NPE:
SEVERE: Servlet.service() for
servlet Register threw exception
java.lang.NullPointerException
at Uxdomain.StudentDAO.insert(StudentDAO.java:19)
at Uxweb.RegistrationServlet.processRequest(RegistrationServlet.java:51)
at Uxweb.RegistrationServlet.doPost(RegistrationServlet.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
The Data Access Class:
My DAO data access code:
public void insert(
String name, String phone, String email, String gender, String amountpaid) {
try {
Connection conn = null;
conn= connPool.mysqlConnection();
PreparedStatement stmt = conn.prepareStatement(INSERT_STMT);
stmt.setString(1, name);
stmt.setString(2, phone);
stmt.setString(3, email);
stmt.setString(4, gender);
stmt.setString(5, amountpaid);
stmt.executeUpdate();
}catch (SQLException se) {
System.out.println("Exception:" + se.getMessage());
}
}
private static final String INSERT_STMT="INSERT INTO studentInfo(studID, name, phone, email, gender, amountpaid) VALUES (0,?,?,?,?,?)";
}