zoukankan      html  css  js  c++  java
  • jsp获取map

    1、简单Map

     User user = new User();
        user.setName("zmy");
        user.setAge(11);
        user.setBirthday(new Date());
        request.setAttribute("user", user);
    
       Map map = new HashMap();
        map.put("sname","light");
        map.put("gender","male");
        map.put("user",user);
        request.setAttribute("map",map);
    ${map.sname}、${map.gender}、${map.user.name}

    2、c:forEach方式

    Map<Integer, Object> map = new HashMap<Integer, Object>();
    map.put(1, "张三");
    map.put(2, "李四");
    model.addAttribute("map", map);
     <c:forEach items="${map}" var="content">
    <span>${content.key}</span>
    <span>${content.value}</span>
    </c:forEach>
  • 相关阅读:
    DRF 版本和认证
    DRF 视图和路由
    DRF 序列化组件
    RESTful
    Vuex以及axios
    npm、webpack、vue-cli
    Vue 生命周期
    Vue Router
    Vue 组件
    Vue 快速入门
  • 原文地址:https://www.cnblogs.com/zouhong/p/11802280.html
Copyright © 2011-2022 走看看