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

📄 useraction.java

📁 一个很短小精致的SSH程序!!!是很多现在工作的编程必备的源码程序~~~得于工作
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package org.tie.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.tie.service.UserService;
import org.tie.struts.form.UserForm;
import org.tie.vo.User;

/**
 * MyEclipse Struts Creation date: 04-06-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/user" name="userForm" input="/index.jsp"
 *                scope="request" validate="true"
 */
public class UserAction extends Action {
	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	private UserService userService;

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		UserForm userForm = (UserForm) form;// TODO Auto-generated method stub
		User user = new User();
		user.setUsername(userForm.getUsername());
		user.setPassword(userForm.getPassword());
		user.setEmail(userForm.getEmail());
		if(userService.regist(user) != null){
			return mapping.findForward("success");
		}else{
			ActionErrors errors = new ActionErrors();
			errors.add("username",new ActionError("errors.username_is_used"));
			saveErrors(request, errors);
			userForm.setPassword("");
			userForm.setPassword2("");
			return mapping.findForward("failure");
		}
		
	}
}

⌨️ 快捷键说明

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