View Javadoc

1   /*
2    * $Id: ValidatorActionForm.java 376984 2006-02-11 14:29:03Z husted $
3    *
4    * Copyright 2000-2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.struts.validator;
19  
20  import org.apache.struts.action.ActionMapping;
21  
22  import javax.servlet.http.HttpServletRequest;
23  
24  import java.io.Serializable;
25  
26  /***
27   * <p>This class extends <strong>ValidatorForm</strong> and provides basic
28   * field validation based on an XML file.  The key passed into the validator
29   * is the action element's 'path' attribute from the struts-config.xml which
30   * should match the form element's name attribute in the validation.xml.</p>
31   *
32   * <ul>
33   *
34   * <li>See <code>ValidatorPlugin</code> definition in struts-config.xml for
35   * validation rules.</li>
36   *
37   * </ul>
38   *
39   * @version $Rev: 376984 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
40   *          $
41   * @since Struts 1.1
42   */
43  public class ValidatorActionForm extends ValidatorForm implements Serializable {
44      /***
45       * Returns the Validation key.
46       *
47       * @param mapping The mapping used to select this instance
48       * @param request The servlet request we are processing
49       * @return validation key - the action element's 'path' attribute in this
50       *         case
51       */
52      public String getValidationKey(ActionMapping mapping,
53          HttpServletRequest request) {
54          return mapping.getPath();
55      }
56  }