title: How to get previous page URL from request using a servlet
body: <p>How do I get the previous page URL from request using a servlet. For example, I'm from the index.html and I submitted a form from index, how do I get the index.html URL and use it in a servlet? </p>
  
  <pre><code>request.getRequestURL()
  </code></pre>
  
  <p>getRequestURL doesn't work since it only returns the URL of the servlet.</p>