1 16 17 package org.apache.taglibs.standard.tag.common.xml; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.JspTagException ; 21 import javax.servlet.jsp.tagext.BodyTagSupport ; 22 import javax.servlet.jsp.tagext.Tag ; 23 24 import org.apache.taglibs.standard.resources.Resources; 25 26 33 34 public abstract class ParamSupport extends BodyTagSupport { 35 36 39 protected String name; protected Object value; 42 45 public ParamSupport() { 46 super(); 47 init(); 48 } 49 50 private void init() { 51 name = null; 52 value = null; 53 } 54 55 56 59 public int doEndTag() throws JspException { 61 Tag t = findAncestorWithClass(this, TransformSupport.class); 62 if (t == null) 63 throw new JspTagException ( 64 Resources.getMessage("PARAM_OUTSIDE_TRANSFORM")); 65 TransformSupport parent = (TransformSupport) t; 66 67 Object value = this.value; 68 if (value == null) { 69 if (bodyContent == null || bodyContent.getString() == null) 70 value = ""; 71 else 72 value = bodyContent.getString().trim(); 73 } 74 parent.addParameter(name, value); 75 return EVAL_PAGE; 76 } 77 78 public void release() { 80 init(); 81 } 82 } 83 | Popular Tags |