1 7 package org.ejtools.servlet.http.jsp.tagext.tree; 8 9 import javax.servlet.jsp.JspException ; 10 import javax.servlet.jsp.tagext.TagSupport ; 11 12 import org.apache.struts.util.RequestUtils; 13 import org.apache.struts.util.ResponseUtils; 14 15 23 public class TreeSpacerTag extends TagSupport 24 { 25 26 protected String name = null; 27 28 protected String property = null; 29 30 protected String scope = null; 31 32 protected String value = null; 33 34 35 41 public int doStartTag() 42 throws JspException 43 { 44 String img = null; 45 String follow = getValue(); 46 47 if (follow == null) 48 { 49 if (name == null) 50 { 51 return (SKIP_BODY); 52 } 53 if (property != null) 54 { 55 follow = (String ) RequestUtils.lookup(pageContext, name, property, scope); 56 } 57 else 58 { 59 follow = (String ) RequestUtils.lookup(pageContext, name, scope); 60 } 61 } 62 63 if (follow.length() <= 0) 64 { 65 return (SKIP_BODY); 66 } 67 68 StringBuffer output = new StringBuffer (); 69 70 for (int i = 0; i < follow.length(); i++) 71 { 72 if ("1".equals(follow.substring(i, i + 1))) 73 { 74 img = "<img SRC=\"images/tree/line.gif\"/>"; 75 } 76 else 77 { 78 img = "<img SRC=\"images/tree/empty.gif\"/>"; 79 } 80 output.append(img); 81 } 82 83 ResponseUtils.write(pageContext, output.toString()); 84 85 return (SKIP_BODY); 87 } 88 89 90 96 public String getName() 97 { 98 return (this.name); 99 } 100 101 102 108 public String getProperty() 109 { 110 return (this.property); 111 } 112 113 114 120 public String getScope() 121 { 122 return (this.scope); 123 } 124 125 126 132 public String getValue() 133 { 134 return (this.value); 135 } 136 137 138 139 140 public void release() 141 { 142 super.release(); 143 value = null; 144 } 145 146 147 152 public void setName(String name) 153 { 154 this.name = name; 155 } 156 157 158 163 public void setProperty(String property) 164 { 165 this.property = property; 166 } 167 168 169 174 public void setScope(String scope) 175 { 176 this.scope = scope; 177 } 178 179 180 185 public void setValue(String value) 186 { 187 this.value = value; 188 } 189 190 } 191 192 | Popular Tags |