tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Richard Sand)
Subject Re: is it possible to use a tag that defines a scripting variable multiple times in a page?
Date Thu, 12 Oct 2000 00:29:48 GMT
Yes but if I want to use it as a scripting variable in the page outside of
my tags then I have to use a TEI to define it at translation time.  And I
tried using a TEI with declare=true and declare=false and it won't work
either way....

Unless I'm missing something?

----- Original Message -----
From: <>
To: <>
Sent: Wednesday, October 11, 2000 8:21 PM
Subject: Re: is it possible to use a tag that defines a scripting variable
multiple times in a page?

> Isn't declaring the variable just you putting it into the page scope if
> it's not already there?
> On Wed, 11 Oct 2000, Richard Sand wrote:
> > Hi all,
> >
> > I'm trying to write a tag that uses a bean that I've written.  I want
the tag to look for the bean in the page context, and if its not there, make
one and add it to the page.  I want to be able to use the tag in multiple
places, and use the bean it creates elsewhere in the page.
> >
> > But this last requirement seems to be a hitch.  i.e., consider the
following in a jsp page:
> >
> > <mytags:tag1/>           // this tag creates a bean with an id=mybean
> > stuff.....
> > <mytags:tag1/>          // this bean sees that id=mybean already exists
and reuses it
> > more stuff......
> > <% if (mybean.somemethod() == true {....         // this code snippet
uses mybean
> >
> > Is this possible? If I write a TEI that defines mybean and has
declare=true, then I get a compile error because mybean is defined twice.
If I have it set to false, I get an error for it being undeclared, even with
only a single use of mytags and no references to mybean.
> >
> > Am I missing something?  Can someone tell me how this can work?  Is
there a way to tell a JSP page that this tag will: "declare a variable if
its not already declared in the page"
> >
> > Thanks!
> >
> > -Richard
> >

View raw message