?? usereditprepareaction.java
字號:
package edu.buptsse.sxjd.actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import edu.buptsse.sxjd.common.Constants;
import edu.buptsse.sxjd.model.User;
import edu.buptsse.sxjd.service.BusinessException;
import edu.buptsse.sxjd.service.UserService;
public class UserEditPrepareAction extends BaseAction {
@Override
public ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws BusinessException {
//從form中取得jsp頁面?zhèn)魉瓦^來用戶編輯的內容
DynaActionForm frm = (DynaActionForm) form;
//取得用戶id號
Integer userid = (Integer) frm.get("id");
UserService us = new UserService();
User user = us.getUserByID(userid);
try {
BeanUtils.copyProperties(frm, user);
} catch (Exception e) {
BusinessException be = new BusinessException();
be.setMessageKey("errors.CopyProperties");
be.setMessageArgs(new String[] { e.getMessage() });
throw be;
}
return mapping.findForward(Constants.SUCCESS_KEY);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -