title: Send response and request from JSP to servlet
body: <p>How can I send my response and request object from a jsp file to a servlet by code? I don't want to submit a form or so.</p>
  
  <p>I tried it with:</p>
  
  <pre><code>response.setRedirect("my page"):
  </code></pre>
  
  <p>But then it says:</p>
  
  <pre><code>Exception in thread "main" org.apache.http.client.HttpResponseException: Moved Temporarily
      at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:68)
      at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:945)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)
      at com.xx.xx.client.Client.sendPOSTRequest(Client.java:185)
      at com.xx.xx.client.Client.main(Client.java:46)
  </code></pre>
  
  <p><strong>As clarification</strong>: I have a client that sends a post request to a JSP file. This JSP file parses a file and puts the needed information into the session. I want to call a servlet from this jsp file to add something into the database. I think this error code is thrown by this line <code>String responseBody = httpclient.execute(httppost, responseHandler);</code></p>