1 package fr.improve.struts.taglib.layout; 2 3 import javax.servlet.jsp.JspException ; 4 5 import fr.improve.struts.taglib.layout.event.StaticCodeIncludeLayoutEvent; 6 import fr.improve.struts.taglib.layout.event.StaticCodeIncludeListener; 7 import fr.improve.struts.taglib.layout.util.TagUtils; 8 9 19 public class DivTag extends LayoutTagSupport implements StaticCodeIncludeListener { 20 23 protected StringBuffer staticCode = new StringBuffer (); 24 25 28 private String styleId; 29 30 33 public int doStartLayoutTag() throws JspException { 34 TagUtils.write(pageContext, "<div"); 36 37 if (styleId!=null) { 39 TagUtils.write(pageContext, " id=\""); 40 TagUtils.write(pageContext, styleId); 41 TagUtils.write(pageContext, "\""); 42 } 43 TagUtils.write(pageContext, ">"); 45 46 return EVAL_BODY_INCLUDE; 48 } 49 50 53 public int doEndLayoutTag() throws JspException { 54 TagUtils.write(pageContext, "</div>"); 56 57 if (staticCode.length()!=0) { 59 TagUtils.write(pageContext, staticCode.toString()); 60 } 61 62 return EVAL_PAGE; 64 } 65 66 69 protected void reset() { 70 super.reset(); 71 staticCode = new StringBuffer (); 72 styleId = null; 73 } 74 75 78 public Object processStaticCodeIncludeEvent(StaticCodeIncludeLayoutEvent in_event) throws JspException { 79 String lc_value = (String ) in_event.sendToParent(this); 81 82 staticCode.append(lc_value); 85 return ""; 86 } 87 88 public String getStyleId() { 89 return styleId; 90 } 91 92 public void setStyleId(String styleId) { 93 this.styleId = styleId; 94 } 95 } 96 | Popular Tags |