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;
        }
  • 相关阅读:
    增强资源管理器右键功能,含源代码
    VC中结构体的内存布局
    进程间共享句柄三种方式
    Delphi获取CPU CPUID《转》
    Delphi中判断WebBrowser的页面是否加载完成 《转》
    Delphi 防止程序多次运行《转》
    界面显示后延时运行代码《转》
    界面显示后延时运行代码《转》
    DIV布局-DIV高度不同自动换行并对齐《转》
    Delphi 语句块《LceMeaning》
  • 原文地址:https://www.cnblogs.com/geniussoft/p/4818633.html
Copyright © 2011-2022 走看看