日期:2014-05-18  浏览次数:20671 次

struts2 session
Java code
public static final String MESSAGE = "welcome to come struts2 world~!";
    private String loginName;
    private String passworld;
    private Map session;  
    public void setSession(Map session) {  
                this.session = session;  
            }  
    public String login() {
        String username = loginName;
        String mima = passworld;
        
        SysuserImp sysuserImp = new SysuserImp();
        // List<Sysuser> user = (List<Sysuser>) new Sysuser();
        List user;
        user = sysuserImp.QuerySysuser(username, mima);
        if (user.size() != 0) {
            Sysuser sysuser = (Sysuser) user.get(0);// 得到这个Sysuser 对像
            String name=sysuser.getAdminName();
            //System.out.print(name);
             session.put("user", sysuser); 
            return this.SUCCESS;
        } else {
            return this.ERROR;
        }

    }



------解决方案--------------------
jf