因为你用的范围不对
httpServletRequest.getSession().setAttribute("name",value);