How to get correct current URL in JSP in Spring webapp How to get correct current URL in JSP in Spring webapp spring spring

How to get correct current URL in JSP in Spring webapp


The best way would be to use EL like this:

${requestScope['javax.servlet.forward.request_uri']}


Maybe you are looking for something like:

<%= new UrlPathHelper().getOriginatingRequestUri(request) %>

This is not that elegant but solved my problem.


In a jsp file:

request.getAttribute("javax.servlet.forward.request_uri")