title: Url parameter to servlet doGet()
body: <p>I'm working on my first web application. I am sending email with an url in it:</p>
  
  <pre><code>http://localhost:8080/HotelP/requeteSuccesO.jsp?hotelId=hampton&amp;city=Montreal
  </code></pre>
  
  <p>When clicking on the link, requeteSuccesO.jsp displays the hotelId and city parameters:</p>
  
  <pre><code>out.println("&lt;b&gt;Hotel:&lt;/b&gt; "+request.getParameter("hotelId")+"&lt;/br&gt;");
  out.println("&lt;b&gt;City:&lt;/b&gt; "+request.getParameter("city")+"&lt;/br&gt;");
  </code></pre>
  
  <p>Then the user can accept by clicking on a button:</p>
  
  <pre><code>&lt;form method="get" action="acceptOffer"&gt;
  &lt;input type="submit" value="Accept" class="sanslabel"&gt;
  </code></pre>
  
  <p>acceptOffer is mapped to a servlet DecisionPage.java, and by clicking on that button it's calling the doGet() method.</p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      // TODO Auto-generated method stub
      System.out.println("in do get DecisionPage, hotelId is "+request.getParameter("hotelId"));
      this.getServletContext().getRequestDispatcher( VUE_PAIEMENT ).forward( request, response );
  }
  </code></pre>
  
  <p>The parameter hotelId received by the doGet function is null, but I am expecting it to be the value found in the url (in our case, "hampton")</p>
  
  <p>Can anyone tell me why I get null and not "hampton" ?</p>