On Tue, 24 Apr 2001, 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
>
This should work:
String organizationId =
pageContext.findAttribute("organizationsBean").getColumn("ORGANIZATIONID");