1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 }