📄 newusergegistrationaction.java
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xslpackage org.conference.action;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.conference.datapersistence.Bo.UserVO;import org.conference.datapersistence.Service.ServiceException;import org.conference.datapersistence.Service.ServiceImple;import org.conference.form.UserForm;/** * MyEclipse Struts Creation date: 05-14-2006 * * XDoclet definition: * * @struts:action path="/newUserGegistration" name="newRegistrationForm" * scope="request" validate="true" * @struts:action-forward name="mainmenu" path="/pages/mainmenu.jsp" */public class NewUserGegistrationAction extends Action { ServiceImple service = new ServiceImple(); UserVO user = new UserVO(); private String password; private String passwordconfirm; /** username property */ private String username; private String gender; private String email; private String interests; // --------------------------------------------------------- Instance // Variables // --------------------------------------------------------- Methods /** * Method execute * * @param mapping * @param form * @param request * @param response * @return ActionForward */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ UserForm userform = (UserForm) form; username = userform.getUsername(); password = userform.getPasswordconfirm(); passwordconfirm = userform.getPasswordconfirm(); gender = userform.getGender(); email = userform.getEmail(); interests = userform.getInterests(); if (username != null && password != null && passwordconfirm != null) { try { if (service.Finduserbyusername(username)==null) { if (password.equals(passwordconfirm)) { user.setName(username); user.setPassword(password); user.setGender(gender); user.setEmail(email); user.setInterests(interests); System.out.println("\n" + user.getName()); try { if (service.NewUserRegistration(user) == 1) { return mapping.findForward("mainmenu"); } } catch (ServiceException e) { // TODO Auto-generated catch block return mapping.findForward("error"); } } } else { return mapping.findForward("userexist"); } } catch (ServiceException e) { // TODO Auto-generated catch block return mapping.findForward("error"); } } return mapping.findForward("errorforblank"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -