`

在Struts2中获得session对象的方法

阅读更多
action中


User nowUser=userDao.getUser(user.getLoginName(), user.getLoginPassword());

  ActionContext ac=ActionContext.getContext();//获得ActionContext 
	       Map app=ac.getApplication(); 
	       ac.getSession().put("login",nowUser);//把登录用户放入session中 
	      


jsp中

<s:if test="#session.login!=null">
   	 	 <td width="152" height="580" style="background-color:#f5f3f4;" valign="top">
    	 <iframe src="studentLeft.action" scrolling="no"  frameborder=0 height="100%" width="100%"></iframe>
    	 </td>
     </s:if>

分享到:
评论
1 楼 zhulin902 2010-08-09  

相关推荐

Global site tag (gtag.js) - Google Analytics