struts2 session 解读

网络编程 2021-07-05 11:23www.168986.cn编程入门
session 在struts2中的用法
HttpSession < session = ServletActionContext.getRequest().getSession();
        例:

        public String findAll(){
     HttpSession session = ServletActionContext.getRequest().getSession();
        list = userService.find();
     session.setAttribute("list", list);
        return this.SUCCESS;
    }
        在jsp中如何得到session中的属性呢:
        如下:

         s:iterator value="#session.list" id="user"
            s:property value="user.userid"
            s:property value="user.firstname"
            s:property value="user.lastname"
         s:iterator

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by