When I press the button, my loader and form are not showing up. The loader is outside the form, but it is still not working. I've tried to solve this issue multiple times without success. I've also added a `Thread.sleep(3000)` to hold the loader for 3 seconds, but it's still not working. Can someone please help me with this? Below are the details of my `signup.jsp` and `Register.java` code:
package com.user;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
public class Register extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
/*out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet Register</title>");
out.println("</head>");
out.println("<body>");*/
//Getting all the details from incoming from request
String name=request.getParameter("user_name");
String email=request.getParameter("user_email");
String password=request.getParameter("user_password");
//out.println(name);
//out.println(email);
//out.println(password);
//connection
try{
Thread.sleep(3000);
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/youtube1","root","Vandana");
//query
String q="insert into user(name,email,password) value(?, ?, ?)";
PreparedStatement pstmpt= con.prepareStatement(q);
pstmpt.setString(1, name);
pstmpt.setString(2, password);
pstmpt.setString(3, email);
pstmpt.executeUpdate();
out.println("Done");
}
catch (Exception e){
e.printStackTrace() ;
out.println("Error");
}
//......
//out.println("</body>");
//out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
**signup.jsp**
...