Hi everyone,

I am currently working on an implementation of a Liferay portlet using
Tapesty 5.1.0.5 and I need to add a prefix for all the ids written in the
generated HTML and the associated javascript. I knew that Tapestry was able
to add a numeric suffix (xxx_0, xxx_1, etc...) and that is how I discovered
the IdAllocator class and its differents uses in Tapestry.

I was really surprised because it seems to be only a simple POJO, so ? how
to override it with Tapestry IOC ?

The prefix I need to add is a piece of information stored in the Request
service and changes for each request, how to inject it in a clean way ?

I began to write a new service named "IdAllocatorFactory" which provides a
new IdAllocator (that I rewrote to add a prefix field) then I patched all
the classes which instantiate an IdAllocator (Form, FormInjector,
RenderSupport, ...) in order to make them use my brand new factory.

But I feel that it is too much ! Tapestry offers great functionnalities, it
is very easy to extend or override, did I forgot something ? Is it mandatory
to replace so many classes ?

Please ! Tell me that there is an easier and cleaner way to add this prefix
in front of all the HTML Ids ! Please !

Thank you in advance,

Amaury

Reply via email to