zoukankan      html  css  js  c++  java
  • Controller比较两个对象discs、outlets中的元素是否相等。相同则相应的checkbox为checked

    比较两个对象discs、outlets中的元素是否相等。相同则相应的checkbox为checked

    <div id="div1" name="div1" class="area" style="position:relative;">
    <c:if test="${!empty outlets}">
    <dl>
    <c:forEach items="${outlets}" var="outlet">
    <c:set var="has" value="0" ></c:set>
    <dd>
    <c:if test="${!empty discs}">
    <c:forEach items="${discs}" var="discs">
    <c:if test="${discs.outlet==outlet.outlet}">
    <c:set var="has" value="1"></c:set>
    </c:if>
    </c:forEach>
    </c:if>
    <input id="outlet" type="checkbox" value="${outlet.outlet }" id="${outlet.outlet }" name="outlet" <c:if test="${has==1}">checked="checked"</c:if> />
    <label for="${outlet.outlet }">${outlet.outlet }-${outlet.desc1 }</label>
    </dd>
    </c:forEach>
    </dl>
    </c:if>
    </div>

    Controller传输discs,outlets

    List<DiscS> discs=discSService.getDiscSByCode(code);
    /* System.out.println(discs.get(0).getOutlet()+"@@");
    System.out.println(discs.get(1).getOutlet()+"!!");
    System.out.println(discs.get(2).getOutlet()+"##");*/
    model.addAttribute("discs",discs);

    List<Outlet> outlets = outletService.getOutlets();
    /*System.out.println(outlets.get(0).getOutlet());
    System.out.println(outlets.get(1).getOutlet());
    System.out.println(outlets.get(2).getOutlet());*/
    model.addAttribute("outlets", outlets);

  • 相关阅读:
    git环境搭建、git详细使用教程、快速上手git
    数据一致性解决方案实践
    锁的使用
    数据库连接池优化
    多级缓存优化实践
    服务端调优与JVM调优
    Sentinel 流量防卫兵
    Spring Cloud Gateway微服务网关
    OpenFeign与负载均衡
    Nacos config原理
  • 原文地址:https://www.cnblogs.com/OP-RONG/p/4244469.html
Copyright © 2011-2022 走看看