1 16 17 package org.apache.taglibs.request; 18 19 import java.util.*; 20 import javax.servlet.*; 21 import javax.servlet.http.*; 22 import javax.servlet.jsp.*; 23 import javax.servlet.jsp.tagext.*; 24 25 72 73 74 public class EqualsAttributeTag extends TagSupport 75 { 76 private String name = null; 77 private String match = null; 78 private boolean ignoreCase = false; 81 private boolean value = true; 82 83 90 public final int doStartTag() throws JspException 91 { 92 boolean result = false; 94 Object attribute = pageContext.getAttribute(name,PageContext.REQUEST_SCOPE); 95 96 if (attribute != null) { 97 String attributeValue = attribute.toString(); 98 99 if (ignoreCase) { 100 result = attributeValue.equalsIgnoreCase(match); 101 } else { 102 result = attributeValue.equals(match); 103 } 104 } 105 106 if( value == result ) 107 return EVAL_BODY_INCLUDE; 108 109 return SKIP_BODY; 110 } 111 112 117 public final void setName(String str) 118 { 119 name = str; 120 } 121 122 123 129 public final void setMatch(String str) { 130 match=str; 131 } 132 133 134 142 public final void setIgnoreCase(boolean value) { 143 ignoreCase = value; 144 } 145 146 151 public final void setValue(boolean value) 152 { 153 this.value = value; 154 } 155 156 } 157 | Popular Tags |