org.apache.tiles.jsp.taglib
Class RenderTagSupport

Package class diagram package RenderTagSupport
java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.tiles.jsp.taglib.RoleSecurityTagSupport
              extended by org.apache.tiles.jsp.taglib.ContainerTagSupport
                  extended by org.apache.tiles.jsp.taglib.RenderTagSupport
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally, PutAttributeTagParent
Direct Known Subclasses:
InsertAttributeTag, InsertDefinitionTag, InsertTemplateTag

public abstract class RenderTagSupport
extends ContainerTagSupport
implements javax.servlet.jsp.tagext.TryCatchFinally, PutAttributeTagParent

Support for all tags which render (a template, or definition).

Properly invokes the defined preparer and invokes the abstract render method upon completion.

This tag takes special care to ensure that the attribute context is reset to it's original state after the execution of the tag is complete. This ensures that all all included attributes in subsequent tiles are scoped properly and do not bleed outside their intended scope.

Since:
Tiles 2.0
See Also:
Serialized Form

Field Summary
protected  boolean flush
          This flag, if true, flushes the content before rendering.
protected  boolean ignore
          This flag, if true, ignores exception thrown by preparers and those caused by problems with definitions.
protected  java.lang.String preparer
          The view preparer to use before the rendering.
 
Fields inherited from class org.apache.tiles.jsp.taglib.ContainerTagSupport
attributeContext, container
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
RenderTagSupport()
           
 
Method Summary
 void doCatch(java.lang.Throwable throwable)
          
 void doFinally()
          
 int doStartTag()
          By default, all ContainerTags evaluate their body.
protected  void execute()
          Execute the tag by invoking the preparer, if defined, and then rendering.
 java.lang.String getPreparer()
          Returns the preparer name.
 boolean isFlush()
          Returns the flush flag.
 boolean isIgnore()
          Returns the ignore flag.
 void processNestedTag(PutAttributeTag nestedTag)
           Process nested ≶put> tag.
 void release()
          
protected abstract  void render()
          Render the specified content.
 void setFlush(boolean flush)
          Sets the flush flag.
 void setIgnore(boolean ignore)
          Sets the ignore flag.
 void setPreparer(java.lang.String preparer)
          Sets the preparer name.
 
Methods inherited from class org.apache.tiles.jsp.taglib.ContainerTagSupport
doEndTag, endContext, startContext
 
Methods inherited from class org.apache.tiles.jsp.taglib.RoleSecurityTagSupport
getRole, isAccessAllowed, setRole
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

preparer

protected java.lang.String preparer
The view preparer to use before the rendering.


flush

protected boolean flush
This flag, if true, flushes the content before rendering.


ignore

protected boolean ignore
This flag, if true, ignores exception thrown by preparers and those caused by problems with definitions.

Constructor Detail

RenderTagSupport

public RenderTagSupport()
Method Detail

getPreparer

public java.lang.String getPreparer()
Returns the preparer name.

Returns:
The preparer name.

setPreparer

public void setPreparer(java.lang.String preparer)
Sets the preparer name.

Parameters:
preparer - The preparer name.

isFlush

public boolean isFlush()
Returns the flush flag. If true, current page out stream is flushed before insertion.

Returns:
The flush flag.

setFlush

public void setFlush(boolean flush)
Sets the flush flag. If true, current page out stream is flushed before insertion.

Parameters:
flush - The flush flag.

isIgnore

public boolean isIgnore()
Returns the ignore flag. If it is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown.

Returns:
The ignore flag.

setIgnore

public void setIgnore(boolean ignore)
Sets the ignore flag. If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown.

Parameters:
ignore - The ignore flag.

release

public void release()

Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class ContainerTagSupport

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
By default, all ContainerTags evaluate their body. Subclasses may choose to be more selective. In any case, children can rely upon the container and attributeContext being initialized if they call super.doStartTag()

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class ContainerTagSupport
Returns:
EVAL_BODY_BUFFERED.
Throws:
javax.servlet.jsp.JspException - If the container has not been initialized.

doCatch

public void doCatch(java.lang.Throwable throwable)
             throws java.lang.Throwable

Specified by:
doCatch in interface javax.servlet.jsp.tagext.TryCatchFinally
Throws:
java.lang.Throwable

doFinally

public void doFinally()

Specified by:
doFinally in interface javax.servlet.jsp.tagext.TryCatchFinally

execute

protected void execute()
                throws org.apache.tiles.TilesException,
                       javax.servlet.jsp.JspException,
                       java.io.IOException
Execute the tag by invoking the preparer, if defined, and then rendering.

Specified by:
execute in class RoleSecurityTagSupport
Throws:
org.apache.tiles.TilesException - if a prepare or render exception occurs.
javax.servlet.jsp.JspException - if a jsp exception occurs.
java.io.IOException - if an io exception occurs.

render

protected abstract void render()
                        throws javax.servlet.jsp.JspException,
                               org.apache.tiles.TilesException,
                               java.io.IOException
Render the specified content.

Throws:
org.apache.tiles.TilesException - if a prepare or render exception occurs.
javax.servlet.jsp.JspException - if a jsp exception occurs.
java.io.IOException - if an io exception occurs.

processNestedTag

public void processNestedTag(PutAttributeTag nestedTag)

Process nested ≶put> tag.

Places the value of the nested tag within the AttributeContext.It is the responsibility of the descendent to check security. Tags extending the ContainerTagSupport will automatically provide the appropriate security.

Specified by:
processNestedTag in interface PutAttributeTagParent
Parameters:
nestedTag - the put tag desciendent.