FileDocCategorySizeDatePackage
ParamSupport.javaAPI DocGlassfish v2 API6770Sat May 05 19:17:52 BST 2007org.apache.taglibs.standard.tag.common.core

ParamSupport

public abstract class ParamSupport extends javax.servlet.jsp.tagext.BodyTagSupport

Support for tag handlers for <param>, the URL parameter subtag for <import> in JSTL 1.0.

see
ParamParent, ImportSupport, URLEncodeSupport
author
Shawn Bayern

Fields Summary
protected String
name
protected String
value
protected boolean
encode
There used to be an 'encode' attribute; I've left this as a vestige in case custom subclasses want to use our functionality but NOT encode parameters.
Constructors Summary
public ParamSupport()


    //*********************************************************************
    // Constructor and initialization

      
	super();
	init();
    
Methods Summary
public intdoEndTag()

	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;
    
private voidinit()

	name = value = null;
    
public voidrelease()

	init();