FileDocCategorySizeDatePackage
FieldError.javaAPI DocExample3274Mon Jul 23 13:26:36 BST 2007org.apache.struts2.components

FieldError

public class FieldError extends UIBean implements org.apache.struts2.components.Param.UnnamedParametric
Render field errors if they exists. Specific layout depends on the particular theme.

Examples



<!-- example 1 -->
<s:fielderror />

<!-- example 2 -->
<s:fielderror>
<s:param>field1</s:param>
<s:param>field2</s:param>
</s:fielderror>
<s:form .... >>
....
</s:form>

OR

<s:fielderror>
<s:param value="%{'field1'}" />
<s:param value="%{'field2'}" />
</s:fielderror>
<s:form .... >>
....
</s:form>


Description



Example 1: display all field errors

Example 2: display field errors only for 'field1' and 'field2'

Fields Summary
private List
errorFieldNames
private static final String
TEMPLATE
Constructors Summary
public FieldError(com.opensymphony.xwork2.util.ValueStack stack, HttpServletRequest request, HttpServletResponse response)


           
        super(stack, request, response);
    
Methods Summary
public voidaddParameter(java.lang.Object value)

        if (value != null) {
            errorFieldNames.add(value.toString());
        }
    
protected java.lang.StringgetDefaultTemplate()


       
        return TEMPLATE;
    
public java.util.ListgetFieldErrorFieldNames()

        return errorFieldNames;