1. 程式人生 > >Struts2 Session中賦值與頁面取值

Struts2 Session中賦值與頁面取值

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>