public class DefaultTagErrorRenderer extends Object implements TagErrorRenderer
This default implementation of the TagErrorRenderer interface sets the html class attribute to 'error'. More specifically, if the tag had no previous CSS class, it will have its class attribute set to error. If it previously had a CSS class attribute, e.g. class="foo", then it's class attribute will be re-written as class="foo error", which instructs the browser to apply both styles, with error taking precedence. The use of a single class name allows applications to define a single style for all input fields, and then override it for specific fields as they choose.
An example of the css definition to set backgrounds to yellow by default, but to red for checkboxes and radio buttons follows:
input.error { background-color: yellow; }
input[type="checkbox"].error, input[type="radio"].error {background-color: red; }
| Constructor and Description |
|---|
DefaultTagErrorRenderer() |
| Modifier and Type | Method and Description |
|---|---|
void |
doAfterEndTag()
Resets the tag's class attribute to it's original value in case the tag gets pooled.
|
void |
doBeforeStartTag()
Ensures that the tag's list of CSS classes includes the "error" class.
|
protected InputTagSupport |
getTag()
Returns the tag which is being rendered.
|
void |
init(InputTagSupport tag)
Simply stores the tag passed in.
|
public void init(InputTagSupport tag)
init in interface TagErrorRenderertag - The InputTagSuppport subclass that will be modifiedprotected InputTagSupport getTag()
public void doBeforeStartTag()
doBeforeStartTag in interface TagErrorRendererpublic void doAfterEndTag()
doAfterEndTag in interface TagErrorRenderer© Copyright 2005-2006, Stripes Development Team.