com.opensymphony.module.sitemesh.taglib.page
Class ApplyDecoratorTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.opensymphony.module.sitemesh.taglib.page.ApplyDecoratorTag
All Implemented Interfaces:
RequestConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ApplyDecoratorTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements RequestConstants

This tag inserts an external resource as a panel into the current Page.

The page attribute should point to the panel resource which should expose an entire page (e.g. another JSP file producing HTML). This attribute can be relative to the page it is being called from or an absolute path from the context-root.

OR

If the page attribute is not specified, the body content is parsed into the Page object and has the Decorator applied.

The (optional) decorator attribute is the name of the Decorator to apply to the included page. Note that the implementation of DecoratorMapper can overide this.

Version:
$Revision: 1.9 $
Author:
Joe Walnes
See Also:
Serialized Form

Nested Class Summary
(package private)  class ApplyDecoratorTag.ApplyDecoratorException
           
 
Field Summary
private  Config config
           
private  String contentType
           
private  String decorator
           
private  DecoratorMapper decoratorMapper
           
private  String encoding
           
private  Factory factory
           
private  String page
           
private  Map params
           
 
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 com.opensymphony.module.sitemesh.RequestConstants
DECORATOR, FILTER_APPLIED, PAGE, ROBOT, USING_STREAM
 
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
ApplyDecoratorTag()
           
 
Method Summary
(package private)  void addParam(String name, String value)
          Add a parameter to the page.
 int doAfterBody()
          Ensure that external page contents are included in bodycontent.
 int doEndTag()
          Standard taglib method: apply decorator to page.
 int doStartTag()
           
private  PageParserSelector getParserSelector()
           
 void setContentType(String contentType)
           
 void setDecorator(String decorator)
          Deprecated. Use setName() instead.
 void setEncoding(String encoding)
           
 void setId(String id)
          Tag attribute: If set, this value will override the 'id' property of the page.
 void setName(String decorator)
          Tag attribute: Name of Decorator to apply to Page.
 void setPage(String page)
          Tag attribute: URI of page to include.
 void setTitle(String title)
          Tag attribute: If set, this value will override the 'title' property of the page.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, 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

page

private String page

decorator

private String decorator

contentType

private String contentType

encoding

private String encoding

params

private Map params

config

private Config config

decoratorMapper

private DecoratorMapper decoratorMapper

factory

private Factory factory
Constructor Detail

ApplyDecoratorTag

public ApplyDecoratorTag()
Method Detail

setPage

public void setPage(String page)
Tag attribute: URI of page to include. Can be relative to page being called from, or absolute path from context-root of web-app.


addParam

void addParam(String name,
              String value)
Add a parameter to the page. This has a package level access modifier so ParamTag can also call it.


setTitle

public void setTitle(String title)
Tag attribute: If set, this value will override the 'title' property of the page. This is a convenience utility and is identical to specifing a 'page:param name=title' tag.


setId

public void setId(String id)
Tag attribute: If set, this value will override the 'id' property of the page. This is a convenience utility and is identical to specifing a 'page:param name=id' tag.

Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport

setName

public void setName(String decorator)
Tag attribute: Name of Decorator to apply to Page. This is passed to DecoratorMapper to retrieve appropriate Decorator. DecoratorMapper may override if needed.

See Also:
DecoratorMapper

setDecorator

public void setDecorator(String decorator)
Deprecated. Use setName() instead.


setContentType

public void setContentType(String contentType)

setEncoding

public void setEncoding(String encoding)

doStartTag

public int doStartTag()
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Ensure that external page contents are included in bodycontent.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Standard taglib method: apply decorator to page.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException

getParserSelector

private PageParserSelector getParserSelector()

www.opensymphony.com/sitemesh/