标签:结果 直接 setattr handle item throws text apt Servle
public class ItemPathInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
request.setAttribute("itemPath", request.getContextPath());
return true;
}
}
或者直接引用 request.getContextPath();
这里的itemPath和前一篇的 ${pageContext.request.contextPath} 是一样的结果,我们可以用${itemPath}
标签:结果 直接 setattr handle item throws text apt Servle
原文地址:https://www.cnblogs.com/littleapple/p/10774106.html