01: package com.technoetic.xplanner.tags;
02:
03: import org.apache.struts.taglib.tiles.InsertTag;
04: import org.apache.struts.tiles.DirectStringAttribute;
05:
06: import javax.servlet.jsp.JspException;
07: import javax.servlet.jsp.tagext.BodyContent;
08: import javax.servlet.jsp.tagext.BodyTag;
09:
10: public class ContentTag extends InsertTag implements BodyTag {
11: private BodyContent bodyContent;
12:
13: public int doStartTag() throws JspException {
14: if (PrintLinkTag.isInPrintMode(pageContext)) {
15: definitionName = "tiles:print";
16: }
17: if (definitionName == null) {
18: definitionName = "tiles:default";
19: }
20: super .doStartTag();
21: return EVAL_BODY_BUFFERED;
22: }
23:
24: public void doInitBody() throws JspException {
25: // empty
26: }
27:
28: public void setBodyContent(BodyContent bodyContent) {
29: this .bodyContent = bodyContent;
30: }
31:
32: public int doEndTag() throws JspException {
33: putAttribute("body", new DirectStringAttribute(bodyContent
34: .getString()));
35: return super .doEndTag();
36: }
37:
38: public void release() {
39: bodyContent = null;
40: super.release();
41: }
42: }
|