关于struts2类型转换的问题
这种方式能修改成功
<td align="right" >
<a href="javascript:document.getElementById('updateForm').submit();">保存</a>
<a href="javascript:window.history.back();">退回 </a>
</td>
</tr>
</table>
<br/>
<br>
<form id="updateForm" method="post" action="<%=request.getContextPath() %>/department/department_update?did=${update_department.did}" >
<%-- <input type="hidden" name="did" value="${update_department.did} "> --%>
<table style="font-size::16px">
<tr>
<td>部门名称:</td>
<td><input type="text" name="dname" value="${update_department.dname} "/></td>
</tr>
<tr>
<td>部门介绍:</td>
<td></td>
</tr>
<tr>
<td width="10%"></td>
<td>
<textarea cols="50" rows="5" name="ddesc">${update_department.ddesc}</textarea>
</td>
</tr>
</table>
这种范是修改失败,setId失败(setId不能使用String参数)
<a href="javascript:document.getElementById('updateForm').submit();">保存</a>
<a href="javascript:window.history.back();">退回 </a>
</td>
</tr>
</table>
<br/>
<br>
<form id="updateForm" method="post" action="<%=request.getContextPath() %>/department/department_update" >
<input type="hidden" name="did" value="${update_department.did} ">
<table style="font-size::16px">
<tr>
<td>部门名称:</td>
<td><input type="text" name="dname" value="${update_department.dname} "/></td>
</tr>
<tr>
<td>部门介绍:</td>
<td></td>
</tr>
<tr>
<td width="10%"></td>
<td>
<textarea cols="50" rows="5" name="ddesc">${update_department.ddesc}</textarea>
</td>
对应action如下
public String update(){
System.out.println(department.getDid());
System.out.println(department.getDname());
System.out.println(department.getDdesc());
//return NONE;
departmentService.update(department);
return "update_success";
}
这是什么原因???