title: Why do I get null values in JSP?
body: <p>I want to use a web form to submit some information and then a JSP page will display the entered form information. However when I clicked the submit button in the form, it goes the correct JSP file but all form values are displayed as "null". I'm using Jersey to do the POST request.</p>
  
  <p>The form is:</p>
  
  <pre><code>&lt;form action="/MyRestWS/rest/customer/created" method="POST"&gt;
      &lt;table border="1"&gt;
          &lt;tr&gt;
              &lt;td&gt;Customer name:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="name"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Customer ID:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="id"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Customer DOB:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="dob"&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br/&gt;
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The code to do the requests is:</p>
  
  <pre><code>@Path("/customer")
  public class CustomerService {
  
      @POST
      @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      @Path("created")
      public Response createCustomer(@FormParam("id") int id, @FormParam("name") String name, @FormParam("dob") Date dob) {
          Response r;
  
          r = Response.ok().entity(new Viewable("/confirm.jsp")).build();
          return r;
      }
  
      @GET
      @Produces(MediaType.TEXT_HTML)
      public Viewable displayForm() {
          return new Viewable("/form.html");
      }
  }
  </code></pre>
  
  <p>The JSP file displayed is <code>confirm.jsp</code> and its content is:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Your entered information&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h2&gt;
          &lt;%
              out.println("You've entered the following information:");
          %&gt;
      &lt;/h2&gt;
  
      &lt;p&gt;
          Customer Name:
          &lt;%=request.getParameter("name")%&gt;&lt;/p&gt;
      &lt;p&gt;
          Customer ID:
          &lt;%=request.getParameter("id")%&gt;&lt;/p&gt;
      &lt;p&gt;
          Customer DOB:
          &lt;%=request.getParameter("dob")%&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If I type the following address in a browser:</p>
  
  <pre><code>http://localhost:8080/MyRestWS/rest/customer
  </code></pre>
  
  <p>It will show me the <code>form.html</code> with the form. After I fill out information and click "Submit", it will go to the following address and display the JSP file as specified by the path:</p>
  
  <pre><code>http://localhost:8080/MyRestWS/rest/customer/created
  </code></pre>
  
  <p>The JSP file shows up correctly but all customer information fields are displayed as "null" like the following:</p>
  
  <pre><code>You've entered the following information:
  
  Customer Name: null
  
  Customer ID: null
  
  Customer DOB: null
  </code></pre>
  
  <p>So why do I get null values in JSP after submitting the form? What's wrong with my code?     </p>