title: JSP Current URL
body: <p>From some other posts, I was able to get the current URI via:</p>
  
  <pre><code>&lt;%= request.getRequestURL() %&gt;
  </code></pre>
  
  <p>However the following doesn't work:</p>
  
  <pre><code>&lt;%! String foo = request.getRequestURL(); %&gt;
  </code></pre>
  
  <p>I'm curious why the above doesn't work, and how to assign the current URI to a string.</p>