1 16 17 package org.apache.taglibs.page; 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); 95 96 if (attribute == null) { 97 result = false; 98 } else { 99 String attributeValue = attribute.toString(); 100 101 if (ignoreCase) { 102 result = attributeValue.equalsIgnoreCase(match); 103 } else { 104 result = attributeValue.equals(match); 105 } 106 } 107 108 if( value == result ) 109 return EVAL_BODY_INCLUDE; 110 111 return SKIP_BODY; 112 } 113 114 119 public final void setName(String str) 120 { 121 name = str; 122 } 123 124 125 131 public final void setMatch(String str) 132 { 133 match = str; 134 } 135 136 137 145 public final void setIgnoreCase(boolean value) 146 { 147 this.ignoreCase = value; 148 } 149 150 155 public final void setValue(boolean value) 156 { 157 this.value = value; 158 } 159 160 } 161 | Popular Tags |