我没有看到你把用户信息对象放进session里,你可以调试一下你的程序执行流程
解决方案 »
- 求大神解决下org.apache.jasper.JasperException这问题,详情在帖内
- jgraphx不能显示中文的问题
- java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
- 使用fileupload上传图片报文件夹拒绝访问错误,请高手指教!!
- 如何在javascript打开url,传中文,然后在jsp中正常接收中文?
- 关于《j2ee Tutorial》中安装hello1.war web module的问题
- 如何把我的移植到UNIX下? 我用的是FREEBSD,
- 关于jBuilder 7 中的字体
- 为什么出错?
- 推荐一本书-J2EE构建企业系统——专家级解决方案
- 改行问题,高手帮忙分析一下..
- 存在对象数组这么回事吗?
* 保存session对象
*/
public void setSession(Map session) {
this.session = session;
}
Map session = ActionContext.getContext().getSession();
session.put("logged-in","true"); 同样在execute方法中,可以清除session变量
Map session = ActionContext.getContext().getSession();
session.remove("logged-in"); 在jsp的head部分引入css文件
<head>
<link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>
</head>在jsp访问session
session Time: </b><%=new Date(session.getLastAccessedTime())%> <a href="<%= request.getContextPath() %>/roseindia/logout.action">Logout</a> jsp中使用struts-tag访问session变量
<s:if test="#session.login != 'admin'">
<jsp:forward page="/pages/uiTags/Login.jsp" />
</s:if>
StaffInfoBean loginStaff = (StaffInfoBean) ServletActionContext.getRequest().getSession().getAttribute("user_bean");
来获得一下,看看有没有值
(StaffInfoBean) ServletActionContext.getRequest().getSession().getAttribute("user_bean");
改为
(StaffInfoBean)session.get("user_bean");