Example usage for org.apache.commons.validator Form getField

List of usage examples for org.apache.commons.validator Form getField

Introduction

In this page you can find the example usage for org.apache.commons.validator Form getField.

Prototype

public Field getField(String fieldName) 

Source Link

Document

Returns the Field with the given name or null if this Form has no such field.

Usage

From source file:org.seasar.struts.customizer.ActionCustomizerTest.java

/**
 * @throws Exception//www .ja  v  a  2 s .c  om
 */
public void testProcessAnnotation() throws Exception {
    Map<String, Form> forms = new HashMap<String, Form>();
    Form form = new Form();
    forms.put("execute", form);
    Field field = BbbAction.class.getDeclaredField("hoge");
    Required r = field.getAnnotation(Required.class);
    customizer.processAnnotation("hoge", r, validatorResources, forms);
    assertNotNull(form.getField("hoge"));
}

From source file:org.seasar.struts.customizer.ActionCustomizerTest.java

/**
 * @throws Exception/*  ww w.j  av  a 2s .com*/
 */
public void testSetupValidator() throws Exception {
    S2ActionMapping actionMapping = customizer.createActionMapping(getComponentDef("aaa_bbbAction"));
    customizer.setupValidator(actionMapping, validatorResources);
    Form form = validatorResources.getForm(Locale.getDefault(), "aaa_bbbActionForm_execute2");
    assertNotNull(form);
    org.apache.commons.validator.Field f = form.getField("hoge");
    assertEquals("hoge", f.getProperty());
    assertEquals("required", f.getDepends());
}

From source file:org.seasar.struts.lessconfig.factory.AbstractValidatorAnnotationHandler.java

protected boolean registeredField(Form form, Field field, PropertyDesc propDesc) {
    String key = getFieldKey(field, propDesc);
    return form.getField(key) != null;
}