Package servlet

Class SignupServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
servlet.SignupServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

@WebServlet("/signup") public class SignupServlet extends javax.servlet.http.HttpServlet
Servlet that handles new customer registration and signup process. Creates customer accounts with password hashing. Validates input data and checks for existing email addresses.
Author:
TAMIL MUGHILAN
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private DataStorage
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Handles GET requests by redirecting to signup page.
    protected void
    doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Handles POST requests for customer registration.
    void
    Initializes the servlet with database storage and customer service.

    Methods inherited from class javax.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SignupServlet

      public SignupServlet()
  • Method Details

    • init

      public void init() throws javax.servlet.ServletException
      Initializes the servlet with database storage and customer service.
      Overrides:
      init in class javax.servlet.GenericServlet
      Throws:
      javax.servlet.ServletException - if initialization fails
    • doGet

      protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
      Handles GET requests by redirecting to signup page. Redirects already logged in users to their appropriate dashboard.
      Overrides:
      doGet in class javax.servlet.http.HttpServlet
      Parameters:
      request - the HTTP servlet request
      response - the HTTP servlet response
      Throws:
      javax.servlet.ServletException - if a servlet error occurs
      IOException - if an I/O error occurs
    • doPost

      protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
      Handles POST requests for customer registration. Validates input, creates customer account, and logs them in automatically.
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Parameters:
      request - the HTTP servlet request containing signup form data
      response - the HTTP servlet response
      Throws:
      javax.servlet.ServletException - if a servlet error occurs
      IOException - if an I/O error occurs