日期:2014-05-17 浏览次数:20639 次
<s:form action="manage_saveorupdate" namespace="/room" method="get">
<s:hidden name="room.room_id"/>
宿舍区域:<s:select list="#request.dareas" listKey="d_area_id" listValue="d_area_name" name="room.darea.d_area_id" />
<br />
楼号:<s:textfield name="room.building_no" />
<input type="submit" value="保存" />
</s:form>
public String saveorupdate() {
try {
if (room.getRoom_id() == null || room.getRoom_id().equals("")) {
room.setRoom_id(-1);
}
System.out.println(room);
roomService.update(room);
ActionContext.getContext().put("message", "保存成功");
} catch (Exception e) {
ActionContext.getContext().put("message", "e");
} finally {
return "message";
}
}
<id type="integer" name="room_id" column="room_id"><generator class="identity" /></id>
<many-to-one name="darea" column="d_area_id" class="Darea"></many-to-one>
<property name="building_no" type="string" length="200" column="building_no" />