Struts2 Session中赋值与页面取值

时间:2020-11-30 09:03:42


Action类中赋值

 

TBranchbranch = new TBranch();
branch.setId(16l);
branch.setCode("4600");
branch.setName("海南省");
super.session().setAttribute("province", branch);


 

Action中取值

TBranchbranch = (TBranch)super.session().getAttribute("province");


 

JSP中取值

<divclass="tag">您现在的位置:<s:propertyvalue="#session['province'].name" />》游戏信息》游戏参数查询</div>