Hi all -
    Sorry if this has been asked and answered - I looked for an archive
but could not find one (although at 2am I might have missed a flying
saucer...)

    Anyway, I'm trying to allow a content developer to specify a
variable name as a parameter to a custom tag. I then want to set the
variable from within the tag and allow the page developer to see that
data with the specified variable name later in the page, something like
this:

<custom:t1 varName="foo"/>
...
Variable data is <%=foo%>  <!-- I get an error here that foo is not
defined -->

My tld file looks like this:
        <name>t1</name>
        <tag-class>blah.boo.T1</tag-class>
        <tei-class>blah.boo.T1ExtraInfo</tei-class>
        <attribute> 
            <name>varName</name>
        </attribute>

My T1ExtraInfo class looks like this:

public class T1ExtraInfo extends TagExtraInfo{

    public VariableInfo[] getVariableInfo(TagData data)
    {
        String var = (String)data.getAttribute("varName");

        System.out.println("varName = " + var); // I see this out put in
the tomcat console

        VariableInfo info = new VariableInfo(var, "java.lang.String",
true, VariableInfo.AT_END);

        VariableInfo[] retVal = new VariableInfo[1];

        retVal[0] = info;

        System.out.println("Returning " + info + " from
T1EI.VariableInfo()"); // and I see this as well

        return retVal;   
    }
}

My tag class (T1) contains the following code:

    public int doStartTag() throws JspException
    {
        pageContext.setAttribute(this.getVarName(), "default");
        return Tag.EVAL_BODY_INCLUDE;
    }



So, what am I missing?

Thanks,
Bryan



--
Bryan Glennon (mailto:[EMAIL PROTECTED])
BPG Consulting, Inc. (http://www.bpgc.com)
Tech Question? (mailto:[EMAIL PROTECTED])

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to