Hi,

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?
If you offer a way to specify the implementation I think a registerInstance method will be the best way. In the ActionServlet.initOther method struts register conversion with the ConvertUtils object:

ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class);
...

At least it's the way it's done in 1.2

We could have a TagUtils.registerInstance() method that will take a TagUtils instance. We could create this instance from a struts property.
I don't know if that make sense in the actual version of struts thought?

Or as I said at least put the instance variable as PROTECTED and NOT final. This way I will be able to inherit from the TagUtils class and change the instance (This method is not fully clean but having the instance PRIVATE FINAL doens`nt make sense anyway (for me at least).


Best Regards
/David Gagnon



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

Reply via email to