1 28 29 package com.caucho.jstl.rt; 30 31 import com.caucho.jstl.ParamContainerTag; 32 import com.caucho.util.L10N; 33 34 import javax.servlet.jsp.JspException ; 35 import javax.servlet.jsp.tagext.BodyTagSupport ; 36 37 40 public class FmtParamTag extends BodyTagSupport { 41 private static L10N L = new L10N(FmtParamTag.class); 42 43 private Object _value; 44 private boolean _hasValue; 45 46 51 public void setValue(Object value) 52 { 53 _value = value; 54 _hasValue = true; 55 } 56 57 60 public int doEndTag() 61 throws JspException 62 { 63 Object value = null; 64 65 if (_hasValue) 66 value = _value; 67 else 68 value = bodyContent.getString().trim(); 69 70 Object parent = getParent(); 71 if (! (parent instanceof ParamContainerTag)) 72 throw new JspException (L.l("fmt:param requires fmt:message parent.")); 73 74 ParamContainerTag message = (ParamContainerTag) parent; 75 76 message.addParam(value); 77 78 return EVAL_PAGE; 79 } 80 } 81 | Popular Tags |