Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Custom Taglib problems - instead of a single instance per page, I have a single instance per application.

Thread view: 
chris brat - 09 May 2006 11:48 GMT
Hi,

What is the correct expected behaviour when using a taglib regarding
how many objects are created per page/application?

More clearly, I created a custom tag (call it MyCustomTag) lib
and am using it in a JSP page - I expected that for each request
a new instance of the MyCustomTag class would be instantiated
and all its instance variables would be initialized.

However only one instance is being created (for multiple requests from
different clients)
and is being 'shared' between multiple pages (it seems to be a single
instance used application wide).

How do I force a single instance of this tag per page?

Thanks
Chris
chris brat - 10 May 2006 12:16 GMT
For anyone who might have the same problem:

I was using Tomcat 5.5 which seems to maintains a pool of instantiated
Tag objects, from which it first retrieves any existing instance before
creating a new instance - I think this is for performance improvements.

This tag pool is then kept in the servlet context - which is why my one
tag instance was available throughout the application.

Chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.