tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <pierre.deli...@sun.com>
Subject Re: exposing script variables
Date Tue, 24 Apr 2001 21:02:21 GMT
Peter,

Do you have a tagExtraInfo class associated with your tag?
This is required to expose a scripting variable.

For example, for the import tag (under xsl):


public final class ImportTei extends TagExtraInfo {
    /**
     * Return information about the scripting variables to be created.
     */
    public VariableInfo[] getVariableInfo(TagData data) {
	return new VariableInfo[] {
	  new VariableInfo(data.getAttributeString("id"),
	                   "java.lang.String",
	                   true,
	                   VariableInfo.AT_END)
	};
    }
}


Peter Alfors wrote:
> 
> Hello all,
> 
>     This is probably a simple question (hopefully) for you all.
> I am writing a tag that is similar to jsp:useBean.
> 
> This new tag needs to be able to make an object available as a scripting
> variable.
> example:
> 
>             <mytaglibs:define id="organizationsBean" scope="session"/>
>             <% String organizationId = (String)
> organizationsBean.getColumn("ORGANIZATIONID"); %>
> 
> The DefineTag class retrieves the object and places the it in the
> pageContext (I've tried APPLICATION, PAGE and REQUEST scope), but when I
> run this, I get the following error:
> 
> "... Undefined variable or class name: organizationsBean
>                  String organizationId = (String)
> organizationsBean.getColumn("ORGANIZATIONID"); "
> 
> However, when using jsp:useBean, this works:
>             <jsp:useBean id="organizationsBean"
> type="com.organizations.OrganizationsBean" scope="session"/>
>             <% String organizationId = (String)
> organizationsBean.getColumn("ORGANIZATIONID"); %>
> 
> What does jsp:useBean do behind the scenes to make the variable
> accessible??
> 
> Thanks,
>     Pete

Mime
View raw message