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

📄 registeraction.java

📁 JAVA +MySql小型用户管理系统 运用Strust+Spring+Hibernate 3框架 实现mvc jsp融合JavaScript+Ajax 技术 程序还有待完善
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.test.struts.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 com.test.struts.domain.User;
import com.test.struts.form.RegisterForm;
import com.test.struts.service.UserPopedomService;
import com.test.struts.service.UserService;

/** 
 * MyEclipse Struts
 * Creation date: 05-09-2009
 * 
 * XDoclet definition:
 * @struts.action path="/register" name="registerForm" input="/form/register.jsp" scope="request" validate="true"
 */
public class RegisterAction extends Action {
	/*
	 * Generated Methods
	 */
	private Integer id=3;
	private String username = "";
	private String password = "";
	private String card = "";
	private String sex;
	private String email = "";
	private String birthday = "";
	private String questionone = "";
	private String answerone = "";
	private String qusetiontwo = "";
	private String answertwo = "";
	private Integer popedom_id = 1;
	private String usermethod;
	private UserService userService;
	private UserPopedomService userPopedomService;
//	private UserPopedom userPopedom;
	
	public UserService getUserService() {
		return userService;
	}
	
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	public UserPopedomService getUserPopedomService() {
		return userPopedomService;
	}

	public void setUserPopedomService(UserPopedomService userPopedomService) {
		this.userPopedomService = userPopedomService;
	}
	/** 
	 * 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;// TODO Auto-generated method stub
		usermethod=request.getParameter("usermethod");
		if(usermethod.equals("add")){
		try {
		
			username = registerForm.getUsername();
			password = registerForm.getPassword();
			card = registerForm.getCard();
			sex = registerForm.getSex();
			email = registerForm.getEmail();
			birthday = registerForm.getBirthday();
			questionone = registerForm.getQuestionone();
			answerone = registerForm.getAnswerone();
			qusetiontwo = registerForm.getQuestiontwo();
			answertwo = registerForm.getAnswertwo();
			userService.addUser(new User(id,username, password, card, sex, email,
					birthday, questionone, answerone, qusetiontwo, answertwo,
					answerone, popedom_id));
			return mapping.findForward("register_ok");
		} catch (Exception e) {

			return mapping.findForward("register_fail");
		}
	}
		return mapping.findForward("register_fail");
	}
	}

⌨️ 快捷键说明

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