May be this is the basic Quest开发者_运维百科ion. But i am not able to understand how to get it.
My browser url is http://testweb/edit.htm'.
testweb is context path. This uri is from Spring. I need to get edit.htm
which is after context, in my jsp. How to get this. Thank you for the support
Thanks, Santha/
The HttpServletRequest
offers several methods to access (parts of) the request URL, among others 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']}
精彩评论