1 16 package org.apache.taglibs.string; 17 18 import javax.servlet.jsp.JspException ; 19 import org.apache.commons.lang.StringUtils; 20 import org.apache.commons.lang.math.NumberUtils; 21 22 44 public class OverlayTag extends StringTagSupport { 45 46 private String start; 47 private String with; 48 private String end; 49 50 public OverlayTag() { 51 super(); 52 } 53 54 59 public String getWith() { 60 return this.with; 61 } 62 63 68 public void setWith(String with) { 69 this.with = with; 70 } 71 72 73 78 public String getStart() { 79 return this.start; 80 } 81 82 87 public void setStart(String start) { 88 this.start = start; 89 } 90 91 92 97 public String getEnd() { 98 return this.end; 99 } 100 101 106 public void setEnd(String end) { 107 this.end = end; 108 } 109 110 111 112 public String changeString(String text) throws JspException { 113 return StringUtils.overlay(text, with, NumberUtils.stringToInt(start), NumberUtils.stringToInt(end)); 114 } 115 116 public void initAttributes() { 117 118 this.with = null; 119 120 this.start = "0"; 121 122 this.end = "0"; 123 124 } 125 126 } 127 | Popular Tags |