View Javadoc

1   /*
2    * $Id: DynaValidatorActionForm.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.commons.beanutils.DynaBean;
21  import org.apache.struts.action.ActionMapping;
22  
23  import javax.servlet.http.HttpServletRequest;
24  
25  import java.io.Serializable;
26  
27  /***
28   * <p>This class extends <strong>DynaValidatorForm</strong> and provides basic
29   * field validation based on an XML file.  The key passed into the validator
30   * is the action element's 'path' attribute from the struts-config.xml which
31   * should match the form element's name attribute in the validation.xml.</p>
32   *
33   * <ul>
34   *
35   * <li>See <code>ValidatorPlugin</code> definition in struts-config.xml for
36   * validation rules.</li>
37   *
38   * </ul>
39   *
40   * @version $Rev: 376984 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
41   *          $
42   * @since Struts 1.1
43   */
44  public class DynaValidatorActionForm extends DynaValidatorForm
45      implements DynaBean, Serializable {
46      /***
47       * Returns the Validation key.
48       *
49       * @param mapping The mapping used to select this instance
50       * @param request The servlet request we are processing
51       * @return validation key - the action element's 'path' attribute in this
52       *         case
53       */
54      public String getValidationKey(ActionMapping mapping,
55          HttpServletRequest request) {
56          return mapping.getPath();
57      }
58  }