title: How to get correct current URL in JSP in Spring webapp
body: <p>I'm trying to get a correct current URL in JSP in Spring webapp. I'm trying to use the following fragment in the JSP file:</p>
  
  <pre><code>${pageContext.request.requestURL}
  </code></pre>
  
  <p>The issue is that the returned URL contains prefix and suffix defined by UrlBasedViewResolver. For example the correct URL is:</p>
  
  <p><a href="http://localhost:8080/page" rel="noreferrer">http://localhost:8080/page</a></p>
  
  <p>But the returned one is:</p>
  
  <p><a href="http://localhost:8080/WEB-INF/jsp/page.jsp" rel="noreferrer">http://localhost:8080/WEB-INF/jsp/page.jsp</a></p>