17

我想request.getContextPath()在扩展的 JSP 标记内调用SimpleTagSupport,有什么办法吗?

4

1 回答 1

22

先得到PageContextby 继承SimpleTagSupport#getJspContext(),然后得到HttpServletRequestby PageContext#getRequest()

PageContext pageContext = (PageContext) getJspContext();  
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();  
于 2010-01-20T12:05:00.963 回答