session.setAttribute( ) 数据存储问题
我初学servlet/JSP,请教大家一个问题。
按MVC的概念,在servlet用bean保存了查询结果,然后用setAttribute存到session中,再转到jsp中去显示。
HttpSession session=request.getSession();
session.setAttribute(...);
dispatcher=request.getRequestDispatcher("...");
dispatcher.forward(request,response);
存放的session中的数据,会一直保存到session失效吗?
在这种方式下,如果有大量用户频繁查询,岂不是会占用很多内存?