title: Pass data to servlet
body: <p>I have a jsp page with a few fields. I need to use some of these fields  in a servlet to get the details of a Car. This is the form in the jsp page:</p>
  
  <pre><code>&lt;form method="post" action="Update"&gt;  
                  &lt;table id="centerTable" width="600"&gt;
                     &lt;tr&gt;                              
                         &lt;th&gt;&lt;h5&gt;Car ID&lt;/h5&gt;&lt;/th&gt;
                         &lt;th&gt;&lt;h5&gt;Car Brand&lt;/h5&gt;&lt;/th&gt;
                      &lt;/tr&gt;                           
                      &lt;tr&gt;
                          &lt;td&gt;${bookedCar.id}&lt;/td&gt;
                          &lt;td&gt;${bookedCar.carbrand}&lt;/td&gt;
                      &lt;/tr&gt;                 
                  &lt;/table&gt;
  
                  &lt;/br&gt;&lt;/br&gt;                                    
                  &lt;p class="submit"&gt;&lt;input type="submit" value="Cancel Booking"&gt;&lt;/p&gt;
  
   &lt;/form&gt;
  </code></pre>
  
  <p>In the servlet Update.java, I have the following in the doPost. I require the car id to use in the Update servlet but I keep getting the value as null. Am I calling the attribute incorrectly?</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
  
  
      Cars myCar = (Cars)request.getAttribute("bookedCar");
      String carID = (String)request.getAttribute("bookedCar.id");
  </code></pre>