I want to call request.getContextPath() inside a JSP tag which extends SimpleTagSupport, is there any way to do it?
request.getContextPath()
SimpleTagSupport
First get the PageContext by the inherited SimpleTagSupport#getJspContext() and then get the HttpServletRequest by PageContext#getRequest().
PageContext
SimpleTagSupport#getJspContext()
HttpServletRequest
PageContext#getRequest()
PageContext pageContext = (PageContext) getJspContext(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
2.1m questions
2.1m answers
60 comments
57.0k users