At 1:57 PM +0200 6/13/06, Antonio Petrelli wrote:
Yes that would be a workaround indeed but somewhat cumbersome since I use this scope everywhere. I do think struts should offer a way to change TagUtils behavior. With the : private final TagUtils instance; there is clearly no way in :-( It should be at least: protected TagUtils instance Or offers a way to specify the implementation to use.

In part I agree with you: the main motivation to use singleton pattern instead of a class with all static methods is to let someone else extend it.

The problem is that these things were designed before the IOC/Dependency Injection design patterns had really infected the minds of open source architects, and there was no standard way to have a framework "discover" implementations of various interfaces. Add that to the fact that no one had brought up any use cases for different implementation classes and you end up with an incomplete solution.

Have you got any suggestions about how the tag code would locate a TagUtils implementation? Actually, for taglibs, it's a little easier, because you can assume access to a pageContext almost anywhere, which means you can look up a TagUtils implementation in application scope. Perhaps a static method on TagUtils which took a ServletContext (or perhaps even a PageContext) and looked under a well-known key for a TagUtils instance or an implementation class name, and if it couldn't find it, reverted to returning the conventional one?

Joe

--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com
"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed.  Try something new."
        -- Robert Moog

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to