net.sourceforge.stripes.tag
Class DefaultTagErrorRendererFactory

java.lang.Object
  extended by net.sourceforge.stripes.tag.DefaultTagErrorRendererFactory
All Implemented Interfaces:
ConfigurableComponent, TagErrorRendererFactory

public class DefaultTagErrorRendererFactory
extends Object
implements TagErrorRendererFactory

A straightforward implementation of the TagErrorRendererFactory interface that looks up the name of the renderer class in config, and if one is not supplied defaults to using the DefaultTagErrorRenderer. The same TagErrorRenderer is instantiated for all tags, and must be public and have a public no-arg constructor.

To configure a different TagErrorRenderer use the configuration key TagErrorRenderer.Class and supply a fully qualified class name. For example, to do this in web.xml you would add the following parameter to the Stripes Filter:

<init-param>
    <param-name>TagErrorRenderer.Class</param-name>
    <param-value>com.myco.web.util.CustomTagErrorRenderer</param-value>
</init-param>

Author:
Greg Hinkle, Tim Fennell

Field Summary
static String RENDERER_CLASS_KEY
           
 
Constructor Summary
DefaultTagErrorRendererFactory()
           
 
Method Summary
protected  Configuration getConfiguration()
           
 TagErrorRenderer getTagErrorRenderer(InputTagSupport tag)
          Returns a new instance of the configured renderer that is ready for use.
 void init(Configuration configuration)
          Looks up the name of the configured renderer class in the configuration and attempts to find the Class object for it.
protected  void setConfiguration(Configuration configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERER_CLASS_KEY

public static final String RENDERER_CLASS_KEY
See Also:
Constant Field Values
Constructor Detail

DefaultTagErrorRendererFactory

public DefaultTagErrorRendererFactory()
Method Detail

init

public void init(Configuration configuration)
          throws Exception
Looks up the name of the configured renderer class in the configuration and attempts to find the Class object for it. If one isn't provided then the default class is used. If the configured class cannot be found an exception will be thrown and the factory is deemed invalid.

Specified by:
init in interface ConfigurableComponent
Parameters:
configuration - the Configuration object being used by Stripes
Throws:
Exception - should be thrown if the component cannot be configured well enough to use.

getTagErrorRenderer

public TagErrorRenderer getTagErrorRenderer(InputTagSupport tag)
Returns a new instance of the configured renderer that is ready for use. By default returns an instance of DefaultTagErrorRenderer. If a custom class is configured and cannot be instantiated, an exception will be thrown.

Specified by:
getTagErrorRenderer in interface TagErrorRendererFactory
Parameters:
tag - The tag that needs to be error rendered
Returns:
TagErrorRenderer the error renderer to render the error output

getConfiguration

protected Configuration getConfiguration()

setConfiguration

protected void setConfiguration(Configuration configuration)


? Copyright 2005-2006, Stripes Development Team.