I want to call request.getContextPath()
inside a JSP tag which extends SimpleTagSupport
, is there any way to do it?
views:
51answers:
1
+1
A:
First get the PageContext
by the inherited SimpleTagSupport#getJspContext()
and then get the HttpServletRequest
by PageContext#getRequest()
.
PageContext pageContext = (PageContext) getJspContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
BalusC
2010-01-20 12:05:00