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 EqualsInitParameterTag 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 88 public final int doStartTag() throws JspException 89 { 90 boolean result = false; 92 String initParam = pageContext.getServletContext().getInitParameter(name); 93 94 if (initParam == null) { 95 result = false; 96 } else { 97 if (ignoreCase) { 98 result = initParam.equalsIgnoreCase(match); 99 } else { 100 result = initParam.equals(match); 101 } 102 } 103 104 if( value == result ) 105 return EVAL_BODY_INCLUDE; 106 107 return SKIP_BODY; 108 } 109 110 115 public final void setName(String str) 116 { 117 name = str; 118 } 119 120 126 public final void setMatch(String str) { 127 match = str; 128 } 129 130 138 public final void setIgnoreCase(boolean value) 139 { 140 ignoreCase = value; 141 } 142 143 148 public final void setValue(boolean value) 149 { 150 this.value = value; 151 } 152 153 } 154 | Popular Tags |