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}

posted on 2019-04-26 14:28  慕筱优  阅读(124)  评论(0编辑  收藏  举报