keyongtech


  keyongtech > java > 05/2006

 #1  
05-09-06, 11:48 AM
chris brat
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
 #2  
05-10-06, 12:16 PM
chris brat
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
Similar Threads
Single instance application

I am programming in c# and making a windows forms application. I don't want to make a windows service. How can I make sure that only once instance of the application runs...

Single-instance WM5.0 application

Hi Guys, How do I ensure a single instance of my Windows Form application? I thought it is part of the framework, but it is not the case. When I tried to click my...

single instance application

I have an application written in C# for Smartphone. I was (obviously) mistaken in thinking that if my app is running and I press the Home key and then click the icon to...

single application instance

Hi, I've read several threads about 1 single instance of application and I tried them but without sucess. Does anyone have a good example for making the main Form as single...

Multi-instance vs single instance application

I have a general question. If I write a application using any language(C/C++/C#/VB). How to make sure it only has one instance running? What I need to write in source code?...


All times are GMT. The time now is 01:30 PM. | Privacy Policy