Tag t = findAncestorWithClass(this, ParamParent.class);
if (t == null)
throw new JspTagException(
Resources.getMessage("PARAM_OUTSIDE_PARENT"));
// take no action for null or empty names
if (name == null || name.equals(""))
return EVAL_PAGE;
// send the parameter to the appropriate ancestor
ParamParent parent = (ParamParent) t;
String value = this.value;
if (value == null) {
if (bodyContent == null || bodyContent.getString() == null)
value = "";
else
value = bodyContent.getString().trim();
}
if (encode) {
// FIXME: revert to java.net.URLEncoder.encode(s, enc) once
// we have a dependency on J2SE 1.4+.
String enc = pageContext.getResponse().getCharacterEncoding();
parent.addParameter(
Util.URLEncode(name, enc), Util.URLEncode(value, enc));
} else {
parent.addParameter(name, value);
}
return EVAL_PAGE;