FileDocCategorySizeDatePackage
MessageTag.javaAPI DocGlassfish v2 API5046Sat May 05 19:17:56 BST 2007org.apache.taglibs.standard.tag.el.fmt

MessageTag

public class MessageTag extends org.apache.taglibs.standard.tag.common.fmt.MessageSupport

A handler for <message> that accepts attributes as Strings and evaluates them as expressions at runtime.

author
Jan Luehe

Fields Summary
private String
key_
private String
bundle_
Constructors Summary
public MessageTag()
Constructs a new MessageTag. As with TagSupport, subclasses should not provide other constructors and are expected to call the superclass constructor

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


        // evaluate any expressions we were passed, once per invocation
        evaluateExpressions();

	// chain to the parent implementation
	return super.doStartTag();
    
private voidevaluateExpressions()

        /* 
         * Note: we don't check for type mismatches here; we assume
         * the expression evaluator will return the expected type
         * (by virtue of knowledge we give it about what that type is).
         * A ClassCastException here is truly unexpected, so we let it
         * propagate up.
         */

	if (keySpecified) {
	    keyAttrValue = (String) ExpressionEvaluatorManager.evaluate(
	        "key", key_, String.class, this, pageContext);
	}

	if (bundleSpecified) {
	    bundleAttrValue = (LocalizationContext)
		ExpressionEvaluatorManager.evaluate(
	            "bundle", bundle_, LocalizationContext.class, this,
		    pageContext);
	} 
    
private voidinit()

        // null implies "no expression"
	key_ = bundle_ = null;
    
public voidrelease()

        super.release();
        init();
    
public voidsetBundle(java.lang.String bundle_)

        this.bundle_ = bundle_;
        this.bundleSpecified = true;
    
public voidsetKey(java.lang.String key_)

        this.key_ = key_;
	this.keySpecified = true;