开发者

How to access request in JspTags?

开发者 https://www.devze.com 2022-12-17 17:45 出处:网络
I want to call request.getContextPath() inside a JSP tag which extends SimpleTagSupport,开发者_C百科 is there any way to do it?First get the PageContext by the inherited SimpleTagSupport#getJspContext

I want to call request.getContextPath() inside a JSP tag which extends SimpleTagSupport,开发者_C百科 is there any way to do it?


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();  
0

精彩评论

暂无评论...
验证码 换一张
取 消