1 16 package org.apache.taglibs.string; 17 18 import javax.servlet.jsp.JspException ; 19 import org.apache.commons.lang.StringUtils; 20 21 38 public class NestedStringTag extends StringTagSupport { 39 40 private String close; 41 private String open; 42 43 public NestedStringTag() { 44 super(); 45 } 46 47 52 public String getOpen() { 53 return this.open; 54 } 55 56 61 public void setOpen(String open) { 62 this.open = open; 63 } 64 65 66 71 public String getClose() { 72 return this.close; 73 } 74 75 80 public void setClose(String close) { 81 this.close = close; 82 } 83 84 85 86 public String changeString(String text) throws JspException { 87 if(close == null) { 88 close = open; 89 } 90 return StringUtils.substringBetween(text, open, close); 91 } 92 93 public void initAttributes() { 94 95 this.open = null; 96 97 this.close = null; 98 99 } 100 101 } 102 | Popular Tags |