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

📄 accountform.java

📁 相信大家不会很陌生的
💻 JAVA
字号:
/*
 * Copyright 2003-2005 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package com.jdon.jivejdon.presentation.form;

import java.util.Collection;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;

import com.jdon.jivejdon.model.Property;
import com.jdon.model.ModelForm;

/**
 * @author <a href="mailto:banqiao@jdon.com">banq</a>
 *
 */
public class AccountForm extends BaseForm {
    private String userId;
    private String username;
    private String name;
    private String password;
    private boolean nameVisible;
    private String email;
    private boolean emailVisible;
    private String address1;
    private String address2;
    private String city;
    private String state;
    private String zip;
    private String country;
    private String phone;    
    private String creationDate;
    private String modifiedDate;
    private Collection propertys;
    private int rewardPoints;
    private int messageCount;
    
    private String repeatedPassword;
    private List myList;
    private boolean authenticated;
    

    public String getUsername() {
        return username;
    }
    /**
     * @param username The username to set.
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return Returns the userId.
     */
    public String getUserId() {
        return userId;
    }
    /**
     * @param userId The userId to set.
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }
    
    
    /**
     * @return Returns the authenticated.
     */
    public boolean isAuthenticated() {
        return authenticated;
    }
    /**
     * @param authenticated The authenticated to set.
     */
    public void setAuthenticated(boolean authenticated) {
        this.authenticated = authenticated;
    }
    /**
     * @return Returns the myList.
     */
    public List getMyList() {
        return myList;
    }
    /**
     * @param myList The myList to set.
     */
    public void setMyList(List myList) {
        this.myList = myList;
    }
    /**
     * @return Returns the repeatedPassword.
     */
    public String getRepeatedPassword() {
        return repeatedPassword;
    }
    /**
     * @param repeatedPassword The repeatedPassword to set.
     */
    public void setRepeatedPassword(String repeatedPassword) {
        this.repeatedPassword = repeatedPassword;
    }
    /**
     * @return Returns the creationDate.
     */
    public String getCreationDate() {
        return creationDate;
    }
    /**
     * @param creationDate The creationDate to set.
     */
    public void setCreationDate(String creationDate) {
        this.creationDate = creationDate;
    }
    /**
     * @return Returns the email.
     */
    public String getEmail() {
        return email;
    }
    /**
     * @param email The email to set.
     */
    public void setEmail(String email) {
        this.email = email;
    }
    /**
     * @return Returns the emailVisible.
     */
    public boolean isEmailVisible() {
        return emailVisible;
    }
    /**
     * @param emailVisible The emailVisible to set.
     */
    public void setEmailVisible(boolean emailVisible) {
        this.emailVisible = emailVisible;
    }
    /**
     * @return Returns the modifiedDate.
     */
    public String getModifiedDate() {
        return modifiedDate;
    }
    /**
     * @param modifiedDate The modifiedDate to set.
     */
    public void setModifiedDate(String modifiedDate) {
        this.modifiedDate = modifiedDate;
    }
    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }
    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @return Returns the nameVisible.
     */
    public boolean isNameVisible() {
        return nameVisible;
    }
    /**
     * @param nameVisible The nameVisible to set.
     */
    public void setNameVisible(boolean nameVisible) {
        this.nameVisible = nameVisible;
    }
    /**
     * @return Returns the password.
     */
    public String getPassword() {
        return password;
    }
    /**
     * @param password The password to set.
     */
    public void setPassword(String password) {
        this.password = password;
    }
    /**
     * @return Returns the propertys.
     */
    public Collection getPropertys() {
        return propertys;
    }
    /**
     * @param propertys The propertys to set.
     */
    public void setPropertys(Collection propertys) {
        this.propertys = propertys;
    }
    
    /**
     * @return Returns the rewardPoints.
     */
    public int getRewardPoints() {
        return rewardPoints;
    }
    /**
     * @param rewardPoints The rewardPoints to set.
     */
    public void setRewardPoints(int rewardPoints) {
        this.rewardPoints = rewardPoints;
    }
    
    

    /**
     * @return Returns the messageCount.
     */
    public int getMessageCount() {
        return messageCount;
    }
    /**
     * @param messageCount The messageCount to set.
     */
    public void setMessageCount(int messageCount) {
        this.messageCount = messageCount;
    }
    /**
     * @return Returns the address1.
     */
    public String getAddress1() {
        return address1;
    }
    /**
     * @param address1 The address1 to set.
     */
    public void setAddress1(String address1) {
        this.address1 = address1;
    }
    /**
     * @return Returns the address2.
     */
    public String getAddress2() {
        return address2;
    }
    /**
     * @param address2 The address2 to set.
     */
    public void setAddress2(String address2) {
        this.address2 = address2;
    }
    /**
     * @return Returns the city.
     */
    public String getCity() {
        return city;
    }
    /**
     * @param city The city to set.
     */
    public void setCity(String city) {
        this.city = city;
    }
    /**
     * @return Returns the country.
     */
    public String getCountry() {
        return country;
    }
    /**
     * @param country The country to set.
     */
    public void setCountry(String country) {
        this.country = country;
    }
    /**
     * @return Returns the phone.
     */
    public String getPhone() {
        return phone;
    }
    /**
     * @param phone The phone to set.
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }
    /**
     * @return Returns the state.
     */
    public String getState() {
        return state;
    }
    /**
     * @param state The state to set.
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * @return Returns the zip.
     */
    public String getZip() {
        return zip;
    }
    /**
     * @param zip The zip to set.
     */
    public void setZip(String zip) {
        this.zip = zip;
    }
    
    public void doValidate(ActionMapping mapping, HttpServletRequest request, List errors) {

        if (ModelForm.EDIT_STR.equals(getAction()) || ModelForm.CREATE_STR.equals(getAction())) {
          if (ModelForm.CREATE_STR.equals(getAction())) {
     //       setStatus("OK");
            addErrorIfStringEmpty(errors, "User ID is required.", getUsername());
            if (getPassword() == null || getPassword().length() < 1 || !getPassword().equals(repeatedPassword)) {
              errors.add("Passwords did not match or were not provided.  Matching passwords are required.");
            }
          }
          if (getPassword() != null && getPassword().length() > 0) {
            if (!getPassword().equals(repeatedPassword)) {
              errors.add("Passwords did not match.");
            }
          }
          addErrorIfStringEmpty(errors, "full name is required.", getName());
          addErrorIfStringEmpty(errors, "Email address is required.", getEmail());
          addErrorIfStringEmpty(errors, "Phone number is required.", getPhone());
          addErrorIfStringEmpty(errors, "Address (1) is required.", getAddress1());
          addErrorIfStringEmpty(errors, "City is required.", getCity());
          addErrorIfStringEmpty(errors, "State is required.", getState());
          addErrorIfStringEmpty(errors, "ZIP is required.", getZip());
          addErrorIfStringEmpty(errors, "Country is required.", getCountry());
        }


    }    
}

⌨️ 快捷键说明

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