If you're using JRun 3.1 (and perhaps other application servers), it's also
a good idea to include a release() method in your tag, which will reset any
instance variables to their initial state.

>From the JRun 3.1 Release Notes:

Caching for JSP custom tag handlers
JRun 3.1 improves JSP custom tag performance by caching tag handler objects.
Tag handler developers should note the following:

Tag handlers are cached per instance per page. For example, if a JSP calls
the same custom tag twice, JRun caches two instances.
If your tag handler performs any kind of state management, you will have to
implement the Tag.release method to perform clean up before JRun caches the
tag instance.


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Steve Bang
Sent: Tuesday, December 18, 2001 2:12 PM
To: [EMAIL PROTECTED]
Subject: Re: Modifying tag attribute values on page reloading


Ahh, you're right -- I guess it's our implementation that prevents the tag
from behaving as expected -- we're setting it to a session scope, I think.
If I remember correctly, we're trying to have tags emulate the behavior of
the Java applets that they're replacing.  Once a Java applet is loaded, the
only way you can change the parameters is programmatically or by killing the
browser and re-opening it.  So, as a side effect of having tags emulate the
applet behavior, we make standard tag functionality not work as expected.
Hmmm...

Steve

> -----Original Message-----
> From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 18, 2001 10:47 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Modifying tag attribute values on page reloading
>
>
> Steve Bang wrote:
> >
> > Anything within a JSP custom tag is interpreted only the
> first time a page
> > is loaded.
>
> Maybe I'm missing something here, but a custom tag is
> executed for every
> request.
>
> > So, if I have a run-time expression value defining an attribute
> > value in the tag, when the page loads, it reads in the
> current value, then
> > on subsequent reloads any changes in that value are ignored.
>
> A request time attribute value, for a standard tag as well as
> a custom tag,
> is evaluated for every request.
>
> > What if I
> > actually want this value to be updated on a page reload,
> because the value
> > is changing?  With standard JSP syntax, I can set the scope
> on a bean -- is
> > there an easy way to do the same when using a custom tag
> instead?  The goal
> > here is to not have to resort to the useBean syntax for
> non-savvy developers
> > who are using the tags.
>
> Unless I miss something, you shouldn't have to worry about
> this at all; just
> define that the custom tag attribute accepts a request time
> attribute value
> in the TLD, and set the value with a JSP expression in the JSP page.
>
> Hans
> --
> Hans Bergsten           [EMAIL PROTECTED]
> Gefion Software         http://www.gefionsoftware.com
> Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to