filter里的代码:
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
HttpServletRequest req2 = (HttpServletRequest) req;
HttpServletResponse res2 = (HttpServletResponse) resp;
HttpSession session = req2.getSession(true);
session.setAttribute("loginName1", "sadsadsad");
chain.doFilter(req2, res2);
}
Controller里的代码:
@At("")
@Ok("beetl:/platform/jyy/index.html")//已修改
public void index(HttpServletRequest request) {
Session s = SecurityUtils.getSubject().getSession();
String ss = s.getAttribute("loginName1").toString();
报空指针。