The HttpServletRequest
offers several methods to access (parts of) the request URL, under each the HttpServletRequest#getRequestURI()
and #getServletPath()
.
That said, this job should be done in a Filter
or maybe a Servlet
rather than a JSP file.
Update: you seem to be using Spring and rather be interested in the request URI which called the forwarded JSP. You can get it as request attribute with the key RequestDispatcher#FORWARD_REQUEST_URI
as follows:
String uri = request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
or in JSP EL as follows:
${requestScope['javax.servlet.forward.request_uri']}