状况一:
<input name="from3" type="submit" class="sure" value="删除" onclick="Vol_delete(${id})"/>里面的type="submit"改成type="button"
状况二:
jsp中返回的值的类型不符合action中的类型
volEdit.jsp:
<tr>
<th>序号</th>
<th><input name="volunteer.id" type="text" class="dfinput" value="${volunteer.id}" style="width:518px;"/></th>
</tr>
<tr>
<th>手机号</th>
<th><input name="volunteer.volid" type="text" class="dfinput" value="${volunteer.volid}" style="width:518px;"/></th>
</tr>其中value=" ${volunteer.id}",在${volunteer.id}前面有空格,int+空格=String
action:
public String update() {
volService.update(volunteer);
return "all";
}在action中类型为"volunteer",所以不符合
改了之后就可以了

本文解决JSP页面与后端Action中数据类型不匹配的问题,通过调整前端表单元素类型及确保传递值的正确性,避免因类型转换错误导致的运行时异常。
279

被折叠的 条评论
为什么被折叠?



