1 16 17 package org.apache.taglibs.standard.examples.taglib; 18 19 import java.lang.reflect.Array ; 20 21 import javax.servlet.jsp.JspTagException ; 22 23 28 29 public class Functions { 30 31 34 public static String display(Object obj) throws JspTagException { 35 if (obj == null) return ""; 36 if (obj instanceof String ) return obj.toString(); 37 59 try { 60 StringBuffer buf = new StringBuffer (); 61 int count = Array.getLength(obj); 62 for (int i=0; i<count; i++) { 63 buf.append(Array.get(obj, i).toString()); 64 if (i<count-1) buf.append("<font color='red'> • </font>"); 65 } 66 return buf.toString(); 67 } catch (IllegalArgumentException ex) {} 68 throw new JspTagException ("Bad Item"); 69 } 70 } 71 | Popular Tags |