Where can a tag built with taglib reserve their resources?

Serge Knystautas

Every tag is a separate instance with a separate constructor call.

One idea would be to hold shared resources in this class or another that is statically accessible. This other class would handle instantiating the resource and provide a static accessor method to grab it.

A better idea is to have the constructor check for the existance of an application scope value, e.g., pageContext.getAttribute(xxx, PageContext.APPLICATION_SCOPE), and if the shared resource wasn't already there, this constructor would create that resource and store in the application scope.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact