Yep, that will work. However, I was hoping to mimic what the jsp:useBean tag
does.
I would like to reduce the amount of script code as much as possible.
The jsp:useBean taglib somehow makes the variable accessible to the page
without having to use pageContext.getAttribute().
Does anyone know how this is done??
my temporary solution (which is not real pretty) is for my DefineTag to place
the object into the request, then
use a jsp:useBean tag to retrieve it from the request.
thanks,
Pete
Morgan Delagrange wrote:
> 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");
begin:vcard
n:;
x-mozilla-html:FALSE
org:<BR><IMG SRC="http://www.irista.com/logo/irista.gif"><BR><BR><FONT Color=#000080><FONT SIZE=2><B>Bringing Vision to Your Supply Chain
adr:;;;;;;
version:2.1
end:vcard