1 16 17 package org.apache.taglibs.application; 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 public class EqualsAttributeTag extends TagSupport 74 { 75 private String name = null; 76 private String match = null; 77 private boolean ignoreCase = false; 80 private boolean value = true; 81 82 89 public final int doStartTag() throws JspException 90 { 91 boolean result = false; 93 Object attribute = pageContext.getServletContext().getAttribute(name); 94 95 if (attribute == null) { 96 result = false; 97 } else { 98 String attributeValue = attribute.toString(); 99 100 if (ignoreCase) { 101 result = attributeValue.equalsIgnoreCase(match); 102 } else { 103 result = attributeValue.equals(match); 104 } 105 } 106 107 if( value == result ) 108 return EVAL_BODY_INCLUDE; 109 110 return SKIP_BODY; 111 112 } 113 114 119 public final void setName(String str) 120 { 121 name = str; 122 } 123 124 130 public final void setMatch(String str) 131 { 132 match = str; 133 } 134 135 143 public final void setIgnoreCase(boolean value) 144 { 145 this.ignoreCase = value; 146 } 147 148 153 public final void setValue(boolean value) 154 { 155 this.value = value; 156 } 157 158 } 159 | Popular Tags |