title: taking servlet information with submit button
body: <p>Im trying to create a Servlet application. When I hit the submit button I want to clear the forms and add the information to a unordered list and store the data. The issue is that I do not know how to evaluate when the button is pushed.</p>
  
  <pre><code>package org.gephi.demos;
  
  // Import required java libraries
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.*;
  
  
  // Extend HttpServlet class
  @WebServlet(name = "HelloWorld", urlPatterns = {"/test"}, loadOnStartup=1)
  public class HelloWorld extends HttpServlet {
  
    private String message;
    private File f;
    private GephiBuilder gb;
    //private Main m;
    public void init() throws ServletException
    {
        gb = new GephiBuilder();
        System.out.println("Initialized");
        // Do required initialization
        message = "Hello World for sure";
    }
  
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
              throws ServletException, IOException
    {
        // Set response content type
        response.setContentType("text/html");
        //m = new Main(gb);
  
        // Actual logic goes here.
          PrintWriter out = response.getWriter();
          out.println(HTMLUserInput("do you want a Nodes(n) or auto(a)", "directory", "d"));
          String directory = request.getParameter("d");
          // do some processing here...
  
          // build HTML code
          if(request.getParameter("button")!=null)
          {
              System.out.println("Hello");
              //response.getParameter("d").valu;
              String htmlRespone = "&lt;html&gt;";
              htmlRespone += "&lt;h2&gt;Your directory is: " + directory + "&lt;br/&gt;";     
              htmlRespone += "&lt;/html&gt;";
  
              // return response
              out.println(htmlRespone);
          }
        //out.println(addJSCode());
    }
  
    public String HTMLUserInput(String question, String id, String name){
          String htmlOutput = "&lt;form action=\"HelloWorld\"&gt;&lt;label&gt;"+question+"&lt;/label&gt;"
              +"&lt;input name = \""+name+"\" id=\""+id+"\" type=\"text\"/&gt;"
              +"&lt;input id=\"button\" type=\"button\"&gt;Submit&lt;/form&gt;";
          return htmlOutput;
    }
  
    public void destroy()
    {
        // do nothing.
    }
  }
  </code></pre>
  
  <p>If I press the button nothing changes, I imagine because this code is only evaluated on startup, how do I get it evaluated anytime I press my submit button.</p>