updateuserpasswordform.java

来自「酒店管理系统 用sh编写的酒店管理系统 毕业设计用的」· Java 代码 · 共 157 行

JAVA
157
字号
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.chen.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.chen.interFace.UserinfoDAO;
import com.chen.interFace.InterFaceDAO.UserinfoDAOImpl;

/** 
 * MyEclipse Struts
 * Creation date: 11-05-2008
 * 
 * XDoclet definition:
 * @struts.form name="updateuserpasswordForm"
 */
public class UpdateuserpasswordForm extends ActionForm {
	/*
	 * Generated fields
	 */

	private String username;
	/** newpassword property */
	private String newpassword;

	/** renewpassword property */
	private String renewpassword;

	/** oldpassword property */
	private String oldpassword;

	/*
	 * Generated Methods
	 */

	/** 
	 * Method validate
	 * @param mapping
	 * @param request
	 * @return ActionErrors
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {


		ActionErrors errors = new ActionErrors();
		UserinfoDAO userinfo = new UserinfoDAOImpl();
		
		if("".equals(this.username)){
			errors.clear();
			errors.add("username", new ActionMessage("nameisempty"));
			return errors;
		}
		if("".equals(this.oldpassword)){
			errors.clear();
			errors.add("oldpassword", new ActionMessage("passwordisempty"));
			return errors;
		}
		if("".equals(this.newpassword)){
			errors.clear();
			errors.add("newpassword", new ActionMessage("passwordisempty"));
			return errors;
		}
		if("".equals(this.renewpassword)){
			errors.clear();
			errors.add("renewpassword", new ActionMessage("passwordisempty"));
			return errors;
		}
		
		if(!((this.newpassword).equals(this.renewpassword))){
			errors.clear();
			errors.add("renewpassword", new ActionMessage("twonewpasswordnotsame"));
			return errors;
		}
		
		if(!userinfo.userLogin(this.username, this.oldpassword)){
			errors.clear();
			errors.add("username",new ActionMessage("idorpasswordisfalse"));
			return errors;
		}
		return null;
		
		
	}

	/** 
	 * Method reset
	 * @param mapping
	 * @param request
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		// TODO Auto-generated method stub
	}

	/** 
	 * Returns the newpassword.
	 * @return String
	 */
	public String getNewpassword() {
		return newpassword;
	}

	/** 
	 * Set the newpassword.
	 * @param newpassword The newpassword to set
	 */
	public void setNewpassword(String newpassword) {
		this.newpassword = newpassword;
	}

	/** 
	 * Returns the renewpassword.
	 * @return String
	 */
	public String getRenewpassword() {
		return renewpassword;
	}

	/** 
	 * Set the renewpassword.
	 * @param renewpassword The renewpassword to set
	 */
	public void setRenewpassword(String renewpassword) {
		this.renewpassword = renewpassword;
	}

	/** 
	 * Returns the oldpassword.
	 * @return String
	 */
	public String getOldpassword() {
		return oldpassword;
	}

	/** 
	 * Set the oldpassword.
	 * @param oldpassword The oldpassword to set
	 */
	public void setOldpassword(String oldpassword) {
		this.oldpassword = oldpassword;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
}

⌨️ 快捷键说明

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