1 18 19 20 package org.apache.struts.taglib.logic; 21 22 23 import javax.servlet.jsp.JspException ; 24 import javax.servlet.jsp.tagext.TagSupport ; 25 import org.apache.struts.util.MessageResources; 26 27 28 33 34 public abstract class ConditionalTagBase extends TagSupport { 35 36 37 39 40 43 protected String cookie = null; 44 45 public String getCookie() { 46 return (this.cookie); 47 } 48 49 public void setCookie(String cookie) { 50 this.cookie = cookie; 51 } 52 53 54 57 protected String header = null; 58 59 public String getHeader() { 60 return (this.header); 61 } 62 63 public void setHeader(String header) { 64 this.header = header; 65 } 66 67 68 71 protected static MessageResources messages = 72 MessageResources.getMessageResources 73 ("org.apache.struts.taglib.logic.LocalStrings"); 74 75 76 81 protected String name = null; 82 83 public String getName() { 84 return (this.name); 85 } 86 87 public void setName(String name) { 88 this.name = name; 89 } 90 91 92 95 protected String parameter = null; 96 97 public String getParameter() { 98 return (this.parameter); 99 } 100 101 public void setParameter(String parameter) { 102 this.parameter = parameter; 103 } 104 105 106 109 protected String property = null; 110 111 public String getProperty() { 112 return (this.property); 113 } 114 115 public void setProperty(String property) { 116 this.property = property; 117 } 118 119 120 123 protected String role = null; 124 125 public String getRole() { 126 return (this.role); 127 } 128 129 public void setRole(String role) { 130 this.role = role; 131 } 132 133 134 138 protected String scope = null; 139 140 public String getScope() { 141 return (this.scope); 142 } 143 144 public void setScope(String scope) { 145 this.scope = scope; 146 } 147 148 149 152 protected String user = null; 153 154 public String getUser() { 155 return (this.user); 156 } 157 158 public void setUser(String user) { 159 this.user = user; 160 } 161 162 163 165 166 172 public int doStartTag() throws JspException { 173 174 if (condition()) 175 return (EVAL_BODY_INCLUDE); 176 else 177 return (SKIP_BODY); 178 179 } 180 181 182 187 public int doEndTag() throws JspException { 188 189 return (EVAL_PAGE); 190 191 } 192 193 194 197 public void release() { 198 199 super.release(); 200 cookie = null; 201 header = null; 202 name = null; 203 parameter = null; 204 property = null; 205 role = null; 206 scope = null; 207 user = null; 208 209 } 210 211 212 214 215 223 protected abstract boolean condition() throws JspException ; 224 225 226 } 227 | Popular Tags |