在進入updateDormitory.jsp頁面,之前,獲取了dormitory和buildings的訊息,放入值棧。頁面就可以獲取得到了。
<td align="center"><a href="beforeUpdateDormitory?Dormitory_ID=${Dormitory_ID}">修改</a>
<action name="beforeUpdateDormitory" class="com.wolf.dormitoryManage.action.AdminAction" method="beforeUpdateDormitory">
<result>/jsp/updateDormitory.jsp</result>
</action>
public String beforeUpdateDormitory() {
DormitoryDao dao = new DormitoryDaoImpl();
int dormitoryID = new Integer(ServletActionContext.getRequest().getParameter("Dormitory_ID"));
dormitory = dao.getByDormitoryID(dormitoryID);
BuildingDao dao2 = new BuildingDaoImpl();
buildings = dao2.list();
return SUCCESS;
}