zoukankan      html  css  js  c++  java
  • 多条数据(子表)提交,后台处理 列子

    jsp

    遍历输出,以生成各个input

                <tr>
                                    <td colspan="7" class="header-bgn-color">三、重要用户用电</td>
                                </tr>
                                <tr>
                                    <td class="title-color">电压等级</td>
                                    <td class="title-color">220kV</td>
                                    <td class="title-color">110kV</td>
                                    <td class="title-color">35kV</td>
                                    <td class="title-color">6kV 10kV 20kV</td>
                                    <td class="title-color" colspan="2">合计</td>
    
                                </tr>
    
    
                                <c:forEach items="${yjdlfhmajoruserloadList}" var="yjdlfhMajorUserLoad" varStatus="index">
                                    <tr>
                                       <td style="display:none">  <input value="${yjdlfhMajorUserLoad.id}"  name="yjdlfhmajoruserload.id"  ></td>
                                       <td style="display:none">  <input value="${yjdlfhzb.id}"  name="yjdlfhmajoruserload.refid"  ></td>
                                       <td style="display:none">  <input value="${yjdlfhMajorUserLoad.xh}"  name="yjdlfhmajoruserload.xh"  ></td>
                                        <td><input value="${yjdlfhMajorUserLoad.dydj}"  name="yjdlfhmajoruserload.dydj"  class="  readonly myInputSubText"></td>
                                        <td><input value="${yjdlfhMajorUserLoad.kV220}"  name="yjdlfhmajoruserload.kV220" class=" myInputSubText"></td>
                                        <td><input value="${yjdlfhMajorUserLoad.kV110}"  name="yjdlfhmajoruserload.kV110"class=" myInputSubText"></td>
                                        <td><input value="${yjdlfhMajorUserLoad.kV35}"  name="yjdlfhmajoruserload.kV35" class=" myInputSubText"></td>
                                        <td><input value="${yjdlfhMajorUserLoad.kV61020}"  name="yjdlfhmajoruserload.kV61020" class=" myInputSubText"></td>
                                        <td colspan="2"><input value="${yjdlfhMajorUserLoad.hj}"  name="yjdlfhmajoruserload.hj" class=" myInputSubText"></td>
                                    </tr>
    
                                </c:forEach>
    View Code

    java

    获取以及封装到实体类

        private void addUserload(HttpServletRequest request, Yjdlfhzb yjdlfhzb) {
            List<Yjdlfhmajoruserload> yjdlfhmajoruserloadList  = new ArrayList<Yjdlfhmajoruserload>();
            String[] dydj = request.getParameterValues("yjdlfhmajoruserload.dydj");
            String[] kV220 = request.getParameterValues("yjdlfhmajoruserload.kV220");
            String[] kV110 = request.getParameterValues("yjdlfhmajoruserload.kV110");
            String[] kV35 = request.getParameterValues("yjdlfhmajoruserload.kV35");
            String[] kV61020 = request.getParameterValues("yjdlfhmajoruserload.kV61020");
            String[] hj = request.getParameterValues("yjdlfhmajoruserload.hj");
            String[] xh = request.getParameterValues("yjdlfhmajoruserload.xh");
            
            for(int i=0;i<dydj.length;i++){
                Yjdlfhmajoruserload e = new Yjdlfhmajoruserload();
                e.setDydj(dydj[i]);
                e.setkV220(kV220[i]);
                e.setkV110(kV110[i]);
                e.setkV35(kV35[i]);
                e.setkV61020(kV61020[i]);
                e.setHj(hj[i]);
                if(xh[i].length()>0){
                    e.setXh(Long.parseLong(xh[i]));
                }
                e.setByzddate(yjdlfhzb.getRq());
                yjdlfhmajoruserloadList.add(e);
            }
            yjdlfhzb.setYjdlfhmajoruserloadList(yjdlfhmajoruserloadList);
        }
    View Code
  • 相关阅读:
    Could not determine which “make” command to run. Check the “make” step in the build configuration
    crontab定时任务不执行的原因
    Linux 设置定时任务crontab命令
    Runtime.getRuntime.exec()执行linux脚本导致程序卡死问题
    Java并发编程:volatile关键字解析
    什么是ClassLoader
    GeoJson格式与转换(shapefile)Geotools
    Docker图形化工具——Portainer
    Docker安装mysql、nginx、redis、tomcat
    Docker中nginx+tomcat实现负载均衡
  • 原文地址:https://www.cnblogs.com/rdchen/p/14536117.html
Copyright © 2011-2022 走看看