KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > validator > ValidatorActionForm


1 /*
2  * $Id: ValidatorActionForm.java 54929 2004-10-16 16:38:42Z germuska $
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
19 package org.apache.struts.validator;
20
21 import java.io.Serializable JavaDoc;
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23
24 import org.apache.struts.action.ActionMapping;
25
26
27 /**
28  * <p>This class extends <strong>ValidatorForm</strong> and provides
29  * basic field validation based on an XML file. The key passed into the
30  * validator is the action element's 'path' attribute from the
31  * struts-config.xml which should match the form element's name attribute
32  * in the validation.xml.</p>
33  *
34  * <ul><li>See <code>ValidatorPlugin</code> definition in struts-config.xml
35  * for validation rules.</li></ul>
36  *
37  * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
38  * @since Struts 1.1
39  */

40
41 public class ValidatorActionForm extends ValidatorForm implements Serializable JavaDoc {
42
43     /**
44      * Returns the Validation key.
45      *
46      * @param mapping The mapping used to select this instance
47      * @param request The servlet request we are processing
48      * @return validation key - the action element's 'path' attribute in this case
49      */

50     public String JavaDoc getValidationKey(ActionMapping mapping,
51                                    HttpServletRequest JavaDoc request) {
52
53         return mapping.getPath();
54     }
55
56 }
57
Popular Tags