解决奖惩信息更新页面信息id不能传到controler层,其他都可以
来源:互联网 发布:wps文字软件下载 编辑:程序博客网 时间:2024/05/16 16:12
<form name="institutionForm" method="post" action="modifyinstitution.do?action=updateInstitution" onSubmit="return institutionValidate()"> <div class="MainDiv"> <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent"> <tr> <th class="tablestyle_title">修改奖惩信息</th> </tr> <tr> <td class="CPanel"> <table border="0" cellpadding="0" cellspacing="0" style="width:80%" align="center"> <tr> <td align="left"> <input type="button" value="返回" onclick="tiaozhuan()" class="button"/> </td> </tr> <tr> <td width="100%"> <fieldset style="height:100%;"> <legend>修改奖惩信息</legend><input type="hidden" name="id" value=""/ > <table border="0" cellpadding="2" cellspacing="1" style="width:100%"> <tr> <td nowrap align="right" width="11%">奖惩对象:</td> <td width="89%"><input name="name" type="text" class="input" value="${updateDetail.username}" placeholder="请选择" onclick="chooseUser('1')" data-toggle="modal" data-target="#myModal" id="userName" /> <span class="red">*</span></td> </tr> <tr> <input id="usernameTemp" type="hidden" value="" /> <input id="userIdTemp" type="hidden" name="userid" value=""/> </tr> <tr> <td nowrap align="right" width="11%">奖惩类型:</td> <td><input name="type" type="text" class="input" value="${updateDetail.type}"/> <span class="red">*</span></td> </tr> <tr> <td width="11%" nowrap align="right">奖惩说明:</td> <td><textarea name="content" cols="100" rows="6" class="input" id="explain" ><c:out value="${updateDetail.content}"/></textarea></td> </tr> <tr> <input name="id" value="${updateDetail.id}"/> <input name="msgid" value="${updateDetail.msgid}"/> <input name="userid" value="${updateDetail.userid}"/> </tr> </table> </fieldset> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" align="center" height="50px"> <input name="提交" type="submit" class="button" value="保存"/> <input name="重置" type="reset" class="button" value="重置"/></TD> </tr> </table> </table> </div></form>
用form表单提交我的其他实体里面的东西都传过来了,就是id传不过来。开始查错,第一,怀疑没拿到返回到更新奖惩信息的页面。把type="hidden"删除,发现可以打印出来,就证明不是这里的原因。怀疑是id这个名字有问题,如果修改了前台以前name为id的input,修改成name="rapid" ,好的,修改了这里的name,后台controler接受的是institutuion实体,要想接受到该值,就必须修改实体,两种方法
1)添加一个实体Rap,在实体里面加入rapid字段,查看返回的rapid,发现可以接受到,好吧,我开始觉得问题出id名字上面了。
2)在实体institution里面添加rapid字段。把前端传过来的rapid接收
package com.jointem.hrm.entity;import java.beans.Transient;import java.io.Serializable;import java.util.Date;public class Institution implements Serializable {private Integer msgid;private Integer id;private Integer userid;private String type;private String content;private Date createtime;private Users users;private Message message;@Transientprivate Integer repid;public Integer getId() {if(null != repid){return id = repid;}else{return id;}}public void setId(Integer id) {this.id = id;}public Integer getUserid() {return userid;}public void setUserid(Integer userid) {this.userid = userid;}public String getType() {return type;}public void setType(String type) {this.type = type;}public String getContent() {return content;}public void setContent(String content) {this.content = content;}public Date getCreatetime() {return createtime;}public void setCreatetime(Date createtime) {this.createtime = createtime;}public Users getUser() {return users;}public void setUser(Users user) {this.users = users;}public Message getMessage() {return message;}public void setMessage(Message message) {this.message = message;}public Integer getMsgid() {return msgid;}public void setMsgid(Integer msgid) {this.msgid = msgid;}public Integer getRepid() {return repid;}public void setRepid(Integer repid) {this.repid = repid;}@Overridepublic String toString() {return "Institution [msgid=" + msgid + ", id=" + id + ", userid=" + userid + ", type=" + type + ", content="+ content + ", createtime=" + createtime + "]";}}
看我加粗的那段代码逻辑,可是传过来的还是id是null,问题就不是出现在id名字问题上了。在更新页面上查是不是“id”这个name与其他的冲突了,发现果然是。看我第一段代码,其中加粗标红的也是id为name,且value值是Null,还排在hidden的input前面,所以不管怎样我获取到的id都是null.把那个重复的删除即可。
阅读全文
0 0
- 解决奖惩信息更新页面信息id不能传到controler层,其他都可以
- Spring MVC Controler层获取errors验证信息 同时返回
- 广播收到信息传到activity更新fragment
- SQL删除id号不同,其他都相同的学生冗余信息
- 用SQL语句删除除了id不同,其他都相同的学生表信息
- 删除除了id号不同,其他都相同的学生冗余信息
- 删除除了id号不同,其他都相同的学生冗余信息
- jQuery 点击页面 获得当前点击元素的id 或者其他信息
- jQuery如何实现点击页面获得当前点击元素的id或其他信息
- Linux 中Tomcat 服务器 启动项目,页面删除报错“该信息被其他信息引用”解决 (ORA-02292)
- 解决laravel5中auth用户登录其他页面获取不到登录信息
- 实现功能:弹出一个DIV层提示等待信息,这个时候禁用用户操作页面中的其他内容
- 解决QQ2009不能发临时会话信息
- yaf写入把数据库信息写入redis,再取出来传到页面上显示 2016-10-22
- 解决只有IE浏览器可以上网,其他浏览器不能上网
- 更新信息
- 信息更新
- 外网的信息是怎么传到我的电脑上的?(已解决)
- ubuntu上解决访问github慢的方法
- Selenium2+Python2.0自动化测试【12】 多表单切换
- 自定义控件:带有清除功能的 ClearEditText
- Hibernate常见面试题
- 代理简析(静态代理与动态代理)
- 解决奖惩信息更新页面信息id不能传到controler层,其他都可以
- redis 安装问题汇总
- 安装XGboost
- jeesite集成cas之多点登出
- Material Design颜色xml
- 【解决】SpringMVC整合Shiro之 Error creating bean with name 'shiroFilter' defined in class path resource...
- Error Code: 1175. You are using safe update...
- nginx access_log日志
- Windows Server 2008 R2远程桌面服务配置和授权激活