title: JSP form submit - Can I reference a specific method in my java class?
body: <p>I'm restricted to work on an enterprise software project using Netbeans IDE, and no frameworks. </p>
  
  <p>The front-end display is <code>register.jsp</code>.  My Model package contains <code>Customer.java</code> class, with some getters and setters.  A Data package contains 'CustomerData.java', with DB functions related to the Customer: registration, log-in, etc.  <code>CustomerData</code> extends <code>HttpServlet</code>.  </p>
  
  <p>I need to reference a specific method from the <code>CustomerData</code> class from my registration form. Is this possible to do?</p>
  
  <p>If this is possible to do, what should the <code>web.xml</code> file entry be for the <code>servlet</code> and <code>servletmapping</code>?</p>
  
  <p>Here is code.</p>
  
  <p><strong>Register.jsp</strong></p>
  
  <pre><code>&lt;form name="loginForm" method="post" action="CustomerData/RegisterCustomer"&gt;
  ......
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>CustomerData.java</strong> skeleton:</p>
  
  <pre><code>public class CustomerData extends HttpServlet {
  
      public void registerCustomer(HttpServletRequest request)
          throws ServletException, IOException
      {
          // this is the method I need to reference. It creates a db connection, checks to see if
          // the Customer is already in the DB, and if not, registers the user.
      }
  
      public void loginCustomer(HTTPServlet request)
          throws ServletException, IOException
      {
          // Some other Customer data method that will need to be called from my login.jsp page
      }
  
      public void SomeOtherMethod()
      {
         // some helper methods or validation methods for Customer
      }
  }
  </code></pre>