title: How to send parameters from a servlet
body: <p>I am trying to use a RequestDispatcher to send parameters from a servlet.</p>
  
  <p>Here is my servlet code:</p>
  
  <pre><code>protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  
   String station = request.getParameter("station");
   String insDate = request.getParameter("insDate");
  
   //test line
   String test = "/response2.jsp?myStation=5";
  
   RequestDispatcher rd;
   if (station.isEmpty()) {
       rd = getServletContext().getRequestDispatcher("/response1.jsp");
  
   } else {
       rd = getServletContext().getRequestDispatcher(test);
   }
  
   rd.forward(request, response);
  
  } 
  </code></pre>
  
  <p>Here is my jsp, with the code to read the value - however it shows null.</p>
  
  <pre><code>    &lt;h1&gt;response 2&lt;/h1&gt;
      &lt;p&gt;
          &lt;%=request.getAttribute("myStation")  %&gt;
      &lt;/p&gt;
  </code></pre>
  
  <p>Thanks for any suggestions.
  Greener</p>