📄 usermappingaction.java
字号:
package com.netctoss.liping.userManage.web.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.MappingDispatchAction;
import com.netctoss.liping.userManage.dao.IUserDAO;
import com.netctoss.liping.userManage.web.form.UserForm;
import com.netctoss.liping.userManage.web.form.UserServiceForm;
public class UserMappingAction extends MappingDispatchAction {
private IUserDAO service;
public ActionForward addUser(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
service.insert( ((UserForm)form ).getUser());
} catch (RuntimeException e) {
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("ok");
}
public ActionForward modifyUser(ActionMapping mapping ,ActionForm form,
HttpServletRequest request, HttpServletResponse response){
try {
service.update( ((UserForm)form ).getUser() );
} catch (RuntimeException e) {
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("ok");
}
public ActionForward addUserService(ActionMapping mapping ,ActionForm form,
HttpServletRequest request, HttpServletResponse response){
try {
service.addService( ((UserServiceForm)form ).getUs() );
} catch (RuntimeException e) {
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("ok");
}
/**
* @param service the service to set
*/
public void setService(IUserDAO service) {
this.service = service;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -