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

Discussion in 'Java' started by chris brat, May 9, 2006.

  1. chris brat

    chris brat Guest

    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, May 9, 2006
    #1
    1. Advertisements

  2. chris brat

    chris brat Guest

    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
     
    chris brat, May 10, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sandeep
    Replies:
    2
    Views:
    563
  2. =?Utf-8?B?S01aX3N0YXRl?=

    Quick one - Is SESSION per browser instance or per IP Address?

    =?Utf-8?B?S01aX3N0YXRl?=, Apr 4, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    6,322
    gerry
    Apr 10, 2006
  3. Tom Cole
    Replies:
    0
    Views:
    557
    Tom Cole
    Jan 21, 2004
  4. Steve Lewis
    Replies:
    2
    Views:
    586
    Chris Smith
    May 19, 2004
  5. Replies:
    4
    Views:
    924
  6. Replies:
    0
    Views:
    537
  7. jobs
    Replies:
    4
    Views:
    867
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jun 24, 2007
  8. Randy Kramer
    Replies:
    2
    Views:
    604
    Randy Kramer
    Jan 12, 2007
Loading...