使用隐藏域input,提交表单未设置默认值,提交报错400
来源:互联网 发布:全部网络歌曲试听 编辑:程序博客网 时间:2024/06/06 17:52
1、 html表单如下:
红色为正确代码,蓝色为出错代码<form action="operate_addenterandexit.html" method="post"><div id="hidden" ><label>班组/个人进退场记录</label><span><select name="type"><option value="2" <c:if test="${type==2}">selected</c:if> style="width:60px">班组</option><option value="1" <c:if test="${type==1}">selected</c:if> style="width:60px">个人</option></select></span></div><div><label>班组名称</label><span><select name="teamName"><c:forEach items="${teamList}" var="team"><option value="${team.name}">${team.name}</option></c:forEach></select></span></div><div><label>姓名</label><span><input name="name" type="text"/></span></div><div><label>联系方式</label><span><input name="cId" type="text"/></span></div><div><label>性质</label><span><select id="eqtime" name=""><!-- 目前这个字段自用来通过js控制前端的页面 --><option value="">进场</option><option value="">退场</option></select></span></div><div class="enter"><label>进场时间</label><span><input name="startTime" type="text" value=""/></span></div><div class="quit"><div><label>退场时间</label><span><input name="endTime" type="text" value="" /></span></div><div class="star"><label>技能</label><ul><li data-star=-5><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=-2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=0><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=5><img src="resource/images/u663.fw.png" alt="" /></li></ul><input type="hidden" name="score1" value='0'/><!--<input type="hidden" name="score1" />--><!--<input type="hidden" name="score1" value=''/>--></div><div class="star"><label>勤劳度</label><ul><li data-star=-5><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=-2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=0><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=5><img src="resource/images/u663.fw.png" alt="" /></li></ul><input type="hidden" name="score2" value='0'/><!--<input type="hidden" name="score2" />--><!--<input type="hidden" name="score2" value=''/>--></div><div class="star"><label>工作态度</label><ul><li data-star=-5><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=-2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=0><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=2><img src="resource/images/u663.fw.png" alt="" /></li><li data-star=5><img src="resource/images/u663.fw.png" alt="" /></li></ul><input type="hidden" name="score3" value='0'/><!--<input type="hidden" name="score3" />--><!--<input type="hidden" name="score3" value='' />--></div><div><label>差评记录</label><span><input name="desc" type="text" /></span></div></div><input type="submit" class="identy" value="保存" /><input type="reset" id="cancel" class="cancel" value="取消" /></form>
2、后台springmvc 直接用model实体类接收,input表单中的三个type为hidden的input标签 提交的字段是int型,score1,score2,score3,model实体中有默认值为0
报错:
后台代码如下:
@RequestMapping(value="operate_addenterandexit.html")public String addEnterAndExit(CommentsModel commentsModel){commentsService.addOneEnterAndExit(commentsModel);return "forward:operate_enterandexit.html";}
实体类model
public class CommentsModel implements BaseIdModel {private String id;private String startTime;// 201509private String endTime;// 201509private String projectName;private String teamName;private String name; //项目管理——员工/班组 进退场 (12月13日)private int score1 = 0;//技能评价 \材料质量评价private int scoreStr1;private int score2 = 0;//勤劳评价 \材料价格评价private int scoreStr2;private int score3 = 0;//态度评价 \ 材料售后评价private int scoreStr3;private String desc;private Date createTime = new Date();private int type;// 1-个人 2-班组 3-材料商 4-设备商private String cId;// tId or userId 如果是班组长的话cId就是tId,如果是个人用户的话cId就是userIdprivate String pId; // 项目的ID
1 0
- 使用隐藏域input,提交表单未设置默认值,提交报错400
- 表单提交设置disabled属性的input数据未提交
- 提交表单不提交隐藏div的input
- 提交表单不提交隐藏div的input
- form 表单提交input信息 回车报错405
- ajax 提交及表单提交报错
- input设置为disabled提交不了表单吗
- input设置为disabled,表单无法提交后台解决方法
- JS 获取和设置input值,控制表单提交地址
- input image 自动提交表单
- html input image提交表单
- input disabled不能提交表单
- input disabled不能提交表单
- springmvc ajax form表单提交出现400报错
- springmvc form表单提交报400错误
- 诡异的ExtJs提交表单报错
- 设置表单自动提交
- 阻止/设置表单提交
- 【Java面试题-004】Java支持哪些数据类型?什么是Autoboxing和Unboxing?
- PHP字符串处理函数
- 教你复制百度文库中的内容
- rfc1321 The MD5 Message-Digest Algorithm
- Javascript中的深层拷贝
- 使用隐藏域input,提交表单未设置默认值,提交报错400
- DOM4J 创建 XML
- Java复习笔记(7)——接口和内部类
- JS函数名称
- python发邮件
- 蓝桥杯BASIC-17(矩阵乘法)
- DISC社交风格测试题--老虎 孔雀 考拉 猫头鹰
- 我的2016
- OpenGL入门学习