"Antony Paul" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thank you for the reply. 'msgtag' don't have attributes. The other tag
> 'outtag' have attributes and it is invoked in service method itself . No
> tags are nested. But I cannot understand the logic in creating a separate
> method call for each tag invocation. In each method it is using same code
> other than the retrieved tag instance is assigned to a new variable and
> methods are invoked on this. Is there any particular reason for doing this
> ?. My reason for asking this question is to know and learn how pooling
> works.

Again, I can't say why Jasper does this without seeing your webapp :).  The
reason that Jasper does message invocations at all is to (hopefully) get
around the Java limitation that no single method can be longer than 64K.
This caused all sorts of problems with TC 3.x and TC 4.0.x with JSP files
that had a lot of Tags.

Pooling is a separate issue:  Jasper will still generate methods even if you
disable pooling.  Pooling involves re-using the same instance of the Tag for
multiple invocations.  This means that a page that looks like:

    ...
    <x:msgtag />
    ...
   <x:msgtag />

will likely use the same Object instance for both calls.  This generally
saves calls to GC, and so allows the page to scale better.  However, the
current TC implementation synchronizes on both the 'get' and the 'put'.  In
some cases this may swamp the savings you get from fewer GCs.  As always,
your mileage may very :)

>
> rgds
> Antony Paul
>
> ----- Original Message -----
> From: "Bill Barker" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, December 30, 2003 11:36 AM
> Subject: Re: [OT] custom tags in a page
>
>
> > Easy question first:  If you don't need BodyTag, don't use it, since it
is
> a
> > potential memory hog.  If you need to process it in a loop, use
> IterationTag
> > instead. (of course this assumes TC 4.x or higher)
> >
> > Hard question last:  Without seeing your JSP page, I can't tell you
> exactly
> > why Jasper chooses to create two methods.  However, popular candidates
> are:
> > 1) The different calls to 'msgtag' specify different attributes sets.
> > 2) One or more of the 'msgtag' invocations  is nested within the body of
> > another Tag.
> >
> > The reason to use method-calls is to (try) and prevent any single method
> in
> > the resulting .class from exceding 64K (at which point javac pucks :).
> >
> > "Antony Paul" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi,
> > >   I wrote two custom tags. One is used only once in the page(msgtag)
> while
> > > the other one is used multiple times(outtag) similar to JSTL c:out.
Both
> > > classes extends BodyTagSupport. When I looked at the compiled servlet
> code
> > > both tags are called in different ways. Each use of msgtag is made a
> > method
> > > call. If I put 2 msgtag(both are exacly same) in JSP it creates 2
> methods.
> > > outtag is invoked directly in servlet.
> > > Why the difference ?.
> > > Is this behavior can be controlled through coding ?.
> > > Which one is better ?.
> > > Why Tomcat is creating one method per each tag invocation.? Why not
> manage
> > > it like an object. Each time it is getting an instance from a pool ?
> > >
> > > BTW Extending TagSupport or BodyTagSupport is better. I have no need
to
> > > process the body ? Any performance gain ?
> > >
> > > rgds
> > > Antony Paul
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >




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

Reply via email to