⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registeraction.java

📁 网上书店源码。功能全面
💻 JAVA
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xslpackage com.ascent.struts.action;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionError;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionMessages;import com.ascent.bean.Customer;import com.ascent.struts.form.RegisterForm;/**  * MyEclipse Struts * Creation date: 09-05-2005 *  * XDoclet definition: * @struts:action path="/register" name="registerForm" input="/reg.jsp" scope="request" validate="true" */public class RegisterAction extends BaseAction {	// --------------------------------------------------------- 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) {		RegisterForm registerForm = (RegisterForm) form;		ActionErrors errors = new ActionErrors();		String customerName = registerForm.getCustomerName();		String password = registerForm.getPassword();		String passwordAgain = registerForm.getPasswordAgain();		String email = registerForm.getEmail();		if(!customerName.equals("") && password.equals(passwordAgain) && !email.equals("")){		Customer cust = new Customer();		cust.setCustName(customerName);		cust.setEmail(email);		cust.setPassword(password);		this.getCustomerService().saveCustomer(cust);		return mapping.findForward("success");		}		else{			errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionError(			"errors.passwordagain"));	        saveErrors(request, errors);	        return mapping.findForward("fail");		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -