1 18 19 package org.apache.strutsel.taglib.logic; 20 21 import org.apache.struts.taglib.logic.MatchTag; 22 import javax.servlet.jsp.JspException ; 23 import org.apache.strutsel.taglib.utils.EvalHelper; 24 25 37 public class ELMatchTag extends MatchTag { 38 39 43 private String cookieExpr; 44 48 private String headerExpr; 49 53 private String locationExpr; 54 58 private String nameExpr; 59 63 private String parameterExpr; 64 68 private String propertyExpr; 69 73 private String scopeExpr; 74 78 private String valueExpr; 79 80 84 public String getCookieExpr() { return (cookieExpr); } 85 89 public String getHeaderExpr() { return (headerExpr); } 90 94 public String getLocationExpr() { return (locationExpr); } 95 99 public String getNameExpr() { return (nameExpr); } 100 104 public String getParameterExpr() { return (parameterExpr); } 105 109 public String getPropertyExpr() { return (propertyExpr); } 110 114 public String getScopeExpr() { return (scopeExpr); } 115 119 public String getValueExpr() { return (valueExpr); } 120 121 125 public void setCookieExpr(String cookieExpr) { this.cookieExpr = cookieExpr; } 126 130 public void setHeaderExpr(String headerExpr) { this.headerExpr = headerExpr; } 131 135 public void setLocationExpr(String locationExpr) { this.locationExpr = locationExpr; } 136 140 public void setNameExpr(String nameExpr) { this.nameExpr = nameExpr; } 141 145 public void setParameterExpr(String parameterExpr) { this.parameterExpr = parameterExpr; } 146 150 public void setPropertyExpr(String propertyExpr) { this.propertyExpr = propertyExpr; } 151 155 public void setScopeExpr(String scopeExpr) { this.scopeExpr = scopeExpr; } 156 160 public void setValueExpr(String valueExpr) { this.valueExpr = valueExpr; } 161 162 165 private String expr; 166 167 171 public String getExpr() { 172 return (expr); 173 } 174 175 179 public void setExpr(String expr) { 180 this.expr = expr; 181 } 182 183 186 private String exprValue; 187 188 191 public String getExprValue() { 192 return (exprValue); 193 } 194 195 198 public void setExprValue(String exprValue) { 199 this.exprValue = exprValue; 200 } 201 202 205 public void release() 206 { 207 super.release(); 208 setCookieExpr(null); 209 setHeaderExpr(null); 210 setLocationExpr(null); 211 setNameExpr(null); 212 setParameterExpr(null); 213 setPropertyExpr(null); 214 setScopeExpr(null); 215 setValueExpr(null); 216 setExpr(null); 217 setExprValue(null); 218 } 219 220 225 public int doStartTag() throws JspException { 226 evaluateExpressions(); 227 return (super.doStartTag()); 228 } 229 230 238 protected boolean condition(boolean desired) throws JspException { 239 boolean result = false; 240 if (getExprValue() != null) { 241 result = 242 ELMatchSupport.condition(desired, getExprValue(), value, 243 location, messages, pageContext); 244 } 245 else { 246 result = super.condition(desired); 247 } 248 return (result); 249 } 250 251 257 private void evaluateExpressions() throws JspException { 258 String string = null; 259 260 if ((string = EvalHelper.evalString("cookie", getCookieExpr(), 261 this, pageContext)) != null) 262 setCookie(string); 263 264 if ((string = EvalHelper.evalString("expr", getExpr(), 265 this, pageContext)) != null) 266 setExprValue(string); 267 268 if ((string = EvalHelper.evalString("header", getHeaderExpr(), 269 this, pageContext)) != null) 270 setHeader(string); 271 272 if ((string = EvalHelper.evalString("location", getLocationExpr(), 273 this, pageContext)) != null) 274 setLocation(string); 275 276 if ((string = EvalHelper.evalString("name", getNameExpr(), 277 this, pageContext)) != null) 278 setName(string); 279 280 if ((string = EvalHelper.evalString("parameter", getParameterExpr(), 281 this, pageContext)) != null) 282 setParameter(string); 283 284 if ((string = EvalHelper.evalString("property", getPropertyExpr(), 285 this, pageContext)) != null) 286 setProperty(string); 287 288 if ((string = EvalHelper.evalString("scope", getScopeExpr(), 289 this, pageContext)) != null) 290 setScope(string); 291 292 if ((string = EvalHelper.evalString("value", getValueExpr(), 293 this, pageContext)) != null) 294 setValue(string); 295 } 296 } 297 | Popular Tags |