title: How to redirect users using HTTP response
body: <p>I have a scenario where the user clicks on a 'restaurant' link (for searching restaurants in a particular locality). I have to check whether the location is set or not. If it is not set, I want to redirect him to a page that allows him to set the location, and, then, go back to search results filtered by the set location. I'm using <code>response.sendRedirect(url)</code> to redirect the user to the setting location page. But, how can I send the redirect back URL (i.e., the URL where I want to send the user after the location is set)?</p>
  
  <p>I tried this:</p>
  
  <pre><code>response.sendRedirect("/location/set.html?action=asklocation&amp;redirectUrl="+
              request.getRequestUri()+request.getQueryString());
  </code></pre>
  
  <p>but this isn't working and 404 error is shown; also, the url formed in the browser doesn't look good.</p>
  
  <p>Please, if anyone could solve the problem ...</p>