java我想从jsp上的控制器方法获取会话值。有人能帮我怎么做吗
我想从controller方法获取到jsp的会话值。有人能帮我怎么做吗
控制器。爪哇
@RequestMapping(value="customerLogin.do", method=RequestMethod.POST)
public String customerLogin(HttpServletRequest request, HttpSession session,HttpServletResponse response) throws SQLException, IOException{
String customerEmail=request.getParameter("customerEmail");
String password= request.getParameter("customerPassword");
Boolean isLoggedIn=false;
Customer customer= serviceInter.logincustomer(customerEmail, password);
if(customer!=null){
isLoggedIn=true;
}
response.getWriter().write(new Gson().toJson(isLoggedIn));
session.setAttribute("customerInfo", customer);
return null;
}
让我在这里获取该值
# 1 楼答案
如何在JSP中检索? 您得到的错误是什么
第二个选项:您还可以将控制器设置为会话范围
# 2 楼答案
您可以使用以下语句获得它: