<%@ 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="width: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;
}

struts2表单批量提交的更多相关文章

  1. 12、Struts2表单重复提交

    什么是表单重复提交 表单的重复提交: 若刷新表单页面, 再提交表单不算重复提交. 在不刷新表单页面的前提下: 多次点击提交按钮 已经提交成功, 按 "回退" 之后, 再点击 &qu ...

  2. Struts2防止表单重复提交

    1.说明 系统拦截器的应用. 表单重复提交:当使用请求转化进行跳转的时候,存在着表单重复提交的问题. 2.在表单中加入s:token 如果页面加入了struts2的标签,页面的请求必须进入struts ...

  3. 【转】Struts2解决表单重复提交问题

    用户重复提交表单在某些场合将会造成非常严重的后果.例如,在使用信用卡进行在线支付的时候,如果服务器的响应速度太慢,用户有可能会多次点击提交按钮,而这可能导致那张信用卡上的金额被消费了多次.因此,重复提 ...

  4. [原创]java WEB学习笔记73:Struts2 学习之路-- strut2中防止表单重复提交

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  5. struts2视频学习笔记 29-30(Struts 2常用标签,防止表单重复提交)

    课时28 Struts 2常用标签解说 property标签 property标签用于输出指定值: <s:set name="name" value="'kk'&q ...

  6. Struts2笔记——利用token防止表单重复提交

    在一些项目中经常会让用户提交表单,当用户点击按钮提交后,如果再次浏览器刷新,这就会造成表单重复提交,若是提交的内容上传至服务器并请求数据库保存,重复提交的表单可能会导致错误,然后跳转到错误界面,这是一 ...

  7. struts2之防止表单重复提交

    struts.xml配置文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts ...

  8. Struts2 处理表单重复提交

    * 在表单页面中增加一个隐藏域:<s:token></s:token>(需要在表单内)        * 创建一个struts.xml的配置文件,具体配置如下:         ...

  9. struts2表单提交的乱码的问题的解决

    今天碰到一乱码问题,百思不得其解. 最后解决办法是设置了表单的提交方式,将method设置为post,解决问题.虽然默认的提交方式是post.但是如果不显式设置的话,就会出现我所出现的问题. 总结下处 ...

随机推荐

  1. AFNetWorking3.0源码分析

    分析: AFNetWorking(3.0)源码分析(一)——基本框架 AFNetworking源码解析 AFNetworking2.0源码解析<一> end

  2. ZooKeeper 笔记(1) 安装部署及hello world

    先给一堆学习文档,方便以后查看 官网文档地址大全: OverView(概述) http://zookeeper.apache.org/doc/r3.4.6/zookeeperOver.html Get ...

  3. flask+sqlite3+echarts3+ajax 异步数据加载

    结构: /www | |-- /static |....|-- jquery-3.1.1.js |....|-- echarts.js(echarts3是单文件!!) | |-- /templates ...

  4. JsonPropertyOrder无法为DTO对象进行属性排序

    在项目中,遇到一个问题,无论怎么设置JsonPropertyOrder,都无法正确实现排序功能,问题代码如下: @JsonPropertyOrder(value={"courseId&quo ...

  5. 恢复 Windows 7 的“回到父目录”按钮

    Windows 7 使用以来很多方面一直不习惯,特别是让我无比纠结的”回到父目录“ 按钮从资源管理器中消失了. 不能不说这是一个失败! 很多时候,Win 7 地址栏中自以为是的显示的很多层目录层次的面 ...

  6. select,poll,epoll比较

    除常用文件i/o外,其他常用io模型:io多路复用(select和poll系统调用)信号驱动I/Olinux专有的epoll编程接口异步io(aio),linux在glibc中提供有基于线程的 pos ...

  7. 关于SQL中的排序问题

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguratio ...

  8. UI: 窗口全屏, 窗口尺寸

    窗口全屏 窗口尺寸 示例1.窗口全屏UI/FullScreen.xaml <Page x:Class="Windows10.UI.FullScreen" xmlns=&quo ...

  9. zookeeper系列之通信模型(转)

    本文的主题就是讲解Zookeeper通信模型,本节将通过一个概要图来说明Zookeeper的通信模型. Zookeeper的通信架构 在Zookeeper整个系统中,有3中角色的服务,client.F ...

  10. Python【第二章】:Python的数据类型

    基本数据类型 一.整型 如: 18.73.84 二.长整型 如:2147483649.9223372036854775807 三.浮点型 如:3.14.2.88 四.字符串 如:'wupeiqi'.' ...