1 16 package org.apache.taglibs.string; 17 18 import javax.servlet.jsp.JspException ; 19 import org.apache.commons.lang.StringUtils; 20 21 36 public class JoinTag extends StringTagSupport { 37 38 private String separator; 39 private Object [] items; 40 41 public JoinTag() { 42 super(); 43 } 44 45 50 public void setItems(Object [] items) { 51 this.items = items; 52 } 53 54 55 60 public void setSeparator(String separator) { 61 this.separator = separator; 62 } 63 64 public String changeString(String text) throws JspException { 65 return this.separator == null ? 66 StringUtils.join( this.items ) : 67 StringUtils.join( this.items, this.separator ); 68 } 69 70 public void initAttributes() { 71 this.separator = null; 72 this.items = null; 73 } 74 75 } 76 | Popular Tags |