|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.stripes.tag.StripesTagSupport
net.sourceforge.stripes.tag.HtmlTagSupport
net.sourceforge.stripes.tag.ErrorsTag
public class ErrorsTag
The errors tag has two modes, one where it displays all validation errors in a list and a second mode when there is a single enclosed field-error tag that has no name attribute in which case this tag iterates over the body, displaying each error in turn in place of the field-error tag.
In the first mode, where the default output is used, it is possible to change the output for the entire application using a set of resources in the error messages bundle (StripesResources.properties unless you have configured another). If the properties are undefined, the tag will output the text "Validation Errors" in a div with css class errorHeader, then output an unordered list of error messages. The following four resource strings (shown with their default values) can be modified to create different default ouput:
This tag has several ways of being attached to the errors of a specific action request. If the tag is inside a action tag, it will display if the validation errors are associated with that action. If supplied a name attribute, it will display errors only if the name attribute matches the name of the submitted action. Finally, if neither is the case, it will always display as described in the paragraph above.
| Field Summary | |
|---|---|
static String |
DEFAULT_FOOTER
The footer that will be emitted if no footer is defined in the resource bundle. |
static String |
DEFAULT_HEADER
The header that will be emitted if no header is defined in the resource bundle. |
| Fields inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
|---|
pageContext, parentTag |
| Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
|---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
| Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
|---|
EVAL_BODY_AGAIN |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
|---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
|---|---|
ErrorsTag()
|
|
| Method Summary | |
|---|---|
int |
doAfterBody()
Manages iteration, running again if there are more errors to display. |
int |
doEndTag()
Output the error list if this was an empty body tag and we're fully controlling output* |
void |
doInitBody()
Sets the context variables for the current error and index |
int |
doStartTag()
Determines if the tag should display errors based on the action that it is displaying for, and then fetches the appropriate list of errors and makes sure it is non-empty. |
String |
getAction()
Returns the value set with setAction(). |
protected ActionBean |
getActionBean()
Fetches the ActionBean associated with the action if one is present. |
ValidationError |
getCurrentError()
Called by the IndividualErrorTag to fetch the current error from the set being iterated. |
String |
getField()
Gets the value set with setField(). |
boolean |
isFirst()
Returns true if the error displayed is the first matching error. |
boolean |
isLast()
Returns true if the error displayed is the last matching error. |
void |
setAction(String action)
Sets the (optional) action of the form to display errors for, if they exist. |
void |
setField(String field)
Sets the (optional) name of a field to display errors for, if errors exist. |
| Methods inherited from class net.sourceforge.stripes.tag.HtmlTagSupport |
|---|
evaluateExpression, get, getAccesskey, getAttributes, getBodyContent, getBodyContentAsString, getCssClass, getDir, getId, getLang, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getStyle, getTabindex, getTitle, release, set, setAccesskey, setBodyContent, setClass, setCssClass, setDir, setId, setLang, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setStyle, setTabindex, setTitle, toString, writeAttributes, writeCloseTag, writeOpenTag, writeSingletonTag |
| Methods inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
|---|
getPageContext, getParent, getParentTag, setPageContext, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.servlet.jsp.tagext.BodyTag |
|---|
setBodyContent |
| Methods inherited from interface javax.servlet.jsp.tagext.Tag |
|---|
getParent, release, setPageContext, setParent |
| Field Detail |
|---|
public static final String DEFAULT_HEADER
public static final String DEFAULT_FOOTER
| Constructor Detail |
|---|
public ErrorsTag()
| Method Detail |
|---|
public ValidationError getCurrentError()
public boolean isFirst()
public boolean isLast()
public void setAction(String action)
public String getAction()
public void setField(String field)
public String getField()
public int doStartTag()
throws JspException
doStartTag in interface TagdoStartTag in class StripesTagSupportJspException
public void doInitBody()
throws JspException
doInitBody in interface BodyTagJspException
public int doAfterBody()
throws JspException
doAfterBody in interface IterationTagJspException
public int doEndTag()
throws JspException
doEndTag in interface TagdoEndTag in class StripesTagSupportJspExceptionprotected ActionBean getActionBean()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||