📄 profileform.java
字号:
/* * CyberTester - J2EE Web application for creating, delivering and managing tests/exams/surveys. * Copyright (C) 2004 CyberDemia Research and Services Pty Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, write to the * Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * See the COPYING file located in the top-level-directory of * the archive of this program for complete text of license. */package com.cyberdemia.cybertester.testee.profile;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.*;import com.cyberdemia.cybertester.CyberTesterUtils;/** * * ProfileForm is a Struts ActionForm to send, receive and validate values from the * user profile editor form. It contains only values that a normal (non-administrator) * user may change. * * @version $Revision: 1.2 $ at $Date: 2004/06/17 13:22:32 $ by $Author: alexycyap $ * @author Alexander Yap */public final class ProfileForm extends ActionForm{ public Integer getId() { return m_id; } public void setId(Integer id) { m_id = id; } public String getLogin() { return m_login; } public void setLogin(String login) { m_login = login; } public String getPassword() { return m_password; } public void setPassword(String password) { m_password = password.trim(); } public String getPassword2() { return m_password2; } public void setPassword2(String password) { m_password2 = password.trim(); } public String getTitle() { return m_title; } public void setTitle(String title) { m_title = title; } public String getFirstName() { return m_firstName; } public void setFirstName(String name) { m_firstName = name.trim(); } public String getLastName() { return m_lastName; } public void setLastName(String name) { m_lastName = name.trim(); } /** * Reset all properties to their default values. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { m_id = null; m_password = null; m_title = null; m_firstName=null; m_lastName=null; m_login = null; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (m_id==null) { errors.add("id", new ActionError("error.user.id.missing")); } CyberTesterUtils.validateRequiredFormEnteredParam("First name", m_firstName, errors); CyberTesterUtils.validateRequiredFormEnteredParam("Last name", m_lastName, errors); if ( (m_password.length()>0) && (!m_password.equals(m_password2))) { errors.add("mismatchPassword", new ActionError("error.password.mismatch")); } return errors; } private Integer m_id = null; private String m_login = null; private String m_password = ""; private String m_password2 = ""; private String m_title = null; private String m_firstName=null; private String m_lastName=null; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -