FileDocCategorySizeDatePackage
RegistrationForm.javaAPI DocExample9021Sun Mar 07 19:48:42 GMT 2004org.apache.struts.webapp.example

RegistrationForm

public final class RegistrationForm extends org.apache.struts.validator.ValidatorForm
Form bean for the user registration page. This form has the following fields, with default values in square brackets:
  • action - The maintenance action we are performing (Create, Delete, or Edit).
  • fromAddress - The EMAIL address of the sender, to be included on sent messages. [REQUIRED]
  • fullName - The full name of the sender, to be included on sent messages. [REQUIRED]
  • password - The password used by this user to log on.
  • password2 - The confirmation password, which must match the password when changing or setting.
  • replyToAddress - The "Reply-To" address to be included on sent messages. [Same as from address]
  • username - The registered username, which must be unique. [REQUIRED]
author
Craig R. McClanahan
version
$Revision: 1.7 $ $Date: 2003/01/18 19:48:56 $

Fields Summary
private String
action
The maintenance action we are performing (Create or Edit).
private String
fromAddress
The from address.
private String
fullName
The full name.
private String
password
The password.
private String
password2
The confirmation password.
private String
replyToAddress
The reply to address.
private String
username
The username.
Constructors Summary
Methods Summary
public java.lang.StringgetAction()
Return the maintenance action.



    // ----------------------------------------------------------- Properties


             
       

	return (this.action);

    
public java.lang.StringgetFromAddress()
Return the from address.


	return (this.fromAddress);

    
public java.lang.StringgetFullName()
Return the full name.


	return (this.fullName);

    
public java.lang.StringgetPassword()
Return the password.


	return (this.password);

    
public java.lang.StringgetPassword2()
Return the confirmation password.


	return (this.password2);

    
public java.lang.StringgetReplyToAddress()
Return the reply to address.


	return (this.replyToAddress);

    
public java.lang.StringgetUsername()
Return the username.


	return (this.username);

    
public voidreset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
Reset all properties to their default values.

param
mapping The mapping used to select this instance
param
request The servlet request we are processing


        this.action = "Create";
        this.fromAddress = null;
        this.fullName = null;
        this.password = null;
        this.password2 = null;
        this.replyToAddress = null;
        this.username = null;

    
public voidsetAction(java.lang.String action)
Set the maintenance action.

param
action The new maintenance action.


        this.action = action;

    
public voidsetFromAddress(java.lang.String fromAddress)
Set the from address.

param
fromAddress The new from address


        this.fromAddress = fromAddress;

    
public voidsetFullName(java.lang.String fullName)
Set the full name.

param
fullName The new full name


        this.fullName = fullName;

    
public voidsetPassword(java.lang.String password)
Set the password.

param
password The new password


        this.password = password;

    
public voidsetPassword2(java.lang.String password2)
Set the confirmation password.

param
password The new confirmation password


        this.password2 = password2;

    
public voidsetReplyToAddress(java.lang.String replyToAddress)
Set the reply to address.

param
replyToAddress The new reply to address


        this.replyToAddress = replyToAddress;

    
public voidsetUsername(java.lang.String username)
Set the username.

param
username The new username


        this.username = username;

    
public org.apache.struts.action.ActionErrorsvalidate(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
Validate the properties that have been set from this HTTP request, and return an ActionErrors object that encapsulates any validation errors that have been found. If no errors are found, return null or an ActionErrors object with no recorded error messages.

param
mapping The mapping used to select this instance
param
request The servlet request we are processing


        // Perform validator framework validations
        ActionErrors errors = super.validate(mapping, request);

        // Only need crossfield validations here
        if (!password.equals(password2)) {
            errors.add("password2",
                       new ActionError("error.password.match"));
        }
        return errors;