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 34 public class LeftTag extends StringTagSupport { 35 36 private String count; 37 38 public LeftTag() { 39 super(); 40 } 41 42 47 public String getCount() { 48 return this.count; 49 } 50 51 56 public void setCount(String count) { 57 this.count = count; 58 } 59 60 61 62 public String changeString(String text) throws JspException { 63 return StringUtils.left(text, NumberUtils.stringToInt(count)); 64 } 65 66 public void initAttributes() { 67 68 this.count = "0"; 69 70 } 71 72 } 73 | Popular Tags |