81,092
社区成员
发帖
与我相关
我的任务
分享
ActionContext context = ActionContext.getContext();
Map request = (Map)context.get("request");
Map session = context.getSession();
Map application = context.getApplication();
session.put("uuser", “aa”);//在session中保存user对象
session.put("uapp", “bbb”);
前台取值这样取:
<body><h3>${sessionScope.user},${sessionScope.uapp}</h3>
</body>
2、直接使用session.put方法
HttpSession session = request.getSession();
//将数据存储到session中
session.setAttribute("uuser", "aa");
session.setAttribute("uapp", "bbb");
对了,楼主你在使用throws抛异常,可以尝试换成try catch