1 19 20 package com.sslexplorer.tabs.tags; 21 22 import javax.servlet.jsp.JspException ; 23 24 import org.apache.struts.taglib.TagUtils; 25 import org.apache.struts.taglib.html.BaseHandlerTag; 26 27 import com.sslexplorer.tabs.TabModel; 28 29 46 public class TabSetTag extends BaseHandlerTag { 47 48 50 protected String name; 51 protected String property; 52 protected String resourcePrefix; 53 protected TabModel model; 54 protected String text; 55 56 61 public int doStartTag() throws JspException { 62 63 Object value = TagUtils.getInstance().lookup(pageContext, name, property, null); 64 if (value == null || !(value instanceof TabModel)) { 65 throw new JspException ("Name / property attributes must specify an instance of TabModel (" + value + ")"); 66 } 67 model = (TabModel) value; 68 return (EVAL_BODY_BUFFERED); 69 } 70 71 protected String getName() { 72 return name; 73 } 74 75 81 public void setName(String name) { 82 this.name = name; 83 } 84 85 92 public void setProperty(String property) { 93 this.property = property; 94 } 95 96 102 public void setResourcePrefix(String resourcePrefix) { 103 this.resourcePrefix = resourcePrefix; 104 } 105 106 109 public int doAfterBody() throws JspException { 110 111 if (bodyContent != null) { 112 String value = bodyContent.getString().trim(); 113 if (value.length() > 0) 114 text = value; 115 } 116 return (SKIP_BODY); 117 118 } 119 120 123 public int doEndTag() throws JspException { 124 125 StringBuffer results = new StringBuffer (); 126 results.append("<div class=\"tabSet\">"); 127 results.append(text); 128 results.append("</div>"); 129 130 TagUtils.getInstance().write(pageContext, results.toString()); 132 133 return (EVAL_PAGE); 135 } 136 137 protected String getResourcePrefix() { 138 return resourcePrefix; 139 } 140 141 protected String getProperty() { 142 return property; 143 } 144 145 protected TabModel getModel() { 146 return model; 147 } 148 } 149 | Popular Tags |