zoukankan      html  css  js  c++  java
  • struts2表单批量提交

    <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
    <%@ taglib prefix="s"     uri="/struts-tags" %>  
    <%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 
    <%@ taglib prefix="fmt"   uri="http://java.sun.com/jstl/fmt" %>
    <%@ page   contentType = "text/html; charset=UTF-8" %> 
    
    <s:form action="dailyDutyListStore" method="post" name="operation" theme="simple">
    <table id="DataList">
    <tr>
        <th nowrap style="text-align:center;">日期</th>
        <th nowrap style="text-align:center;">值班领导</th>
        <th nowrap style="text-align:center;">当值值班长</th>
        <th nowrap style="text-align:center;">值班警员</th>
        <th nowrap style="text-align:center;">值班警力</th>
    </tr>
    
    <s:iterator value="dailyDutys" status="status">
    <tr>
        <td nowrap align="center">
            <input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].key" value="<s:property value='key'/>"/>
            <input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].dutyDate" value="<s:date name='dutyDate' format='yyyy-MM-dd'/>"/>
            <input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].deptName" value="<s:property value='deptName'/>"/>
            <input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].deptType" value="<s:property value='deptType'/>"/>
            
            
            <s:date name="dutyDate" format="yyyy/MM/dd"/>
        </td>
        <td nowrap align="center">
            <input type="text" name="dailyDutys[<s:property value='#status.index'/>].people1" value="<s:property value='people1'/>"/>
        </td>
        <td nowrap align="center">
            <input type="text" name="dailyDutys[<s:property value='#status.index'/>].people2" value="<s:property value='people2'/>"/>
        </td>
        <td nowrap align="center">
            <input type="text" name="dailyDutys[<s:property value='#status.index'/>].people3" value="<s:property value='people3'/>" style="400px;"/>
        </td>
        <td nowrap align="center">
            <input type="text" name="dailyDutys[<s:property value='#status.index'/>].dutyNum" value="<fmt:formatNumber value='${dutyNum}' pattern="#" type="number"/>"/>
        </td>
    </tr>
    </s:iterator>
    
    </table>
    </s:form>
    
    <tiles:insertTemplate template="../../tiles/bars/submitbar.jsp" flush="true"/>
    
    <style>
     .checkboxLabel {
        vertical-align:top;
        width:180px;
        display:inline-block;
        }
        .selectBox {
        border:none;
        }
    </style>
    /**
         * 保存值班基本信息。根据保存的value对应的key值来区分是创建create还是修改edit
         * 如果key值为空,那就创建;如果key值不为空,那就保存
         * @return forward
         * @throws ParseException 
         */
        public String store()
            throws NamingException, ParseException
        {
            if(this._dailyDutys == null || this._dailyDutys.size() == 0)
            {
                super.addActionError("未找到内容!");
                return ERROR;
            }
            DailyDutyLocal dailyDutyDao = EjbUtil.getDailyDutyLocal();
            for(DailyDuty value : this._dailyDutys)
            {
                if(value == null)
                {
                    continue;
                }
                if(StringFactory.isNotNull(value.getKey()))//修改
                {
                    DailyDuty theDailyDuty = dailyDutyDao.findDailyDuty(value.getKey());
                    theDailyDuty.setValue(value);
                    dailyDutyDao.doMerge(theDailyDuty);
                }
                else//新建
                {
                    value.setCreateBy(super.getCurrentUser().getName());
                    dailyDutyDao.createDailyDuty(value);
                }
            }
            return SUCCESS;
        }
  • 相关阅读:
    MINIX文件系统
    Cmd Markdown 语法
    asp.net mvc 4 json大数据异常 提示JSON字符长度超出限制的异常[转载]
    echart 拖拽
    搭建django开发环境
    Django 1.11.7+django_pyodbc_azure-1.11.0.0+pyodbc 连接mssql 数据库
    二、PyCharm 创建Django 第一个项目
    一、Django 安装
    python 连接各类主流数据库简单示例【转载】
    Python 3.6 连接mssql数据库(pymssql 方式)
  • 原文地址:https://www.cnblogs.com/geniussoft/p/4818633.html
Copyright © 2011-2022 走看看