jsp编写的网上书店

时间:2015-10-26 13:46:44
【文件属性】:

文件名称:jsp编写的网上书店

文件大小:5.19MB

文件格式:RAR

更新时间:2015-10-26 13:46:44

jsp

public class addUserAction extends Action{ /** * 在此方法中处理HTTP请求数据,并作响应 */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors=new ActionErrors(); userOPBean userOP=new userOPBean(); userBean user=new userBean(); //------得到用户对象------ addUserForm userForm=(addUserForm)form; user.setUser_address(userForm.getUser_address()); user.setUser_name(userForm.getUser_name()); user.setUser_password(userForm.getUser_password()); user.setUser_postalcode(userForm.getUser_postalcode()); user.setUser_role(userForm.getUser_role()); user.setUser_telephone(userForm.getUser_telephone()); user.setUser_true_name(userForm.getUser_true_name()); //------增加用户------ int i=userOP.addUser(user); if(i!=1){ errors.add("inserterror",new ActionMessage("user.insertError")); saveErrors(request,errors); return(new ActionForward(mapping.findForward("addusererror"))); } request.removeAttribute(mapping.getAttribute());//删除formBean return mapping.findForward("addusersuccess"); }


网友评论