1 package fr.improve.struts.taglib.layout.collection; 2 3 import javax.servlet.jsp.JspException ; 4 import javax.servlet.jsp.tagext.BodyContent ; 5 import javax.servlet.jsp.tagext.BodyTag ; 6 7 18 public class CollectionItemTag extends FastCollectionItemTag implements BodyTag { 19 protected BodyContent bodyContent; 20 protected boolean useBody = true; 21 22 public void doInitBody() throws JspException { 23 } 25 public int doAfterBody() throws JspException { 26 return SKIP_BODY; 28 } 29 public void setBodyContent(BodyContent in_content) { 30 bodyContent = in_content; 31 } 32 33 public void release() { 34 super.release(); 35 bodyContent = null; 36 } 37 38 public int doStartLayoutTag() throws JspException { 39 int lc_result = super.doStartLayoutTag(); 40 if (lc_result==EVAL_BODY_INCLUDE) { 41 return EVAL_BODY_TAG; 42 } else { 43 return lc_result; 44 } 45 } 46 47 protected Object buildContent() throws JspException { 48 if (bodyContent != null && bodyContent.getString().length() > 0) { 49 Object lc_cell = bodyContent.getString(); 51 bodyContent.clearBody(); 52 useBody = true; 53 return lc_cell; 54 } else { 55 useBody = false; 56 return super.buildContent(); 57 } 58 } 59 60 protected boolean buildFilter() { 61 if (useBody) { 62 return false; 63 } else { 64 return super.buildFilter(); 65 } 66 } 67 68 } 69 | Popular Tags |