1 16 package org.apache.taglibs.string; 17 18 import javax.servlet.jsp.JspException ; 19 20 39 public class DefaultTag extends StringTagSupport { 40 41 private String defaultValue; 42 private String value; 43 44 public DefaultTag() { 45 super(); 46 } 47 48 53 public String getValue() { 54 return this.value; 55 } 56 57 62 public void setValue(String value) { 63 this.value = value; 64 } 65 66 67 72 public String getDefault() { 73 return this.defaultValue; 74 } 75 76 81 public void setDefault(String defaultValue) { 82 this.defaultValue = defaultValue; 83 } 84 85 86 87 public String changeString(String text) throws JspException { 88 if( (""+text).equals(this.value) ) { 89 return this.defaultValue; 90 } else { 91 return text; 92 } 93 } 94 95 public void initAttributes() { 96 97 this.value = "null"; 98 99 this.defaultValue = ""; 100 101 } 102 103 } 104 | Popular Tags |