Hi all,
one need that repeatedly araises in our project is the one to write some
javascript support code to be called from event behaviors or to integrate
external libraries. Often these code fragments need to reference other
wicket managed tags that have their own auto generated ids. So normally we
divide the code a bit unnaturally in a way that code with id references is
programatically generated and the rest, static one, resides at the markup
file. IMO a nifty solution to keep all the code in one place could be to
write a component that simply treats its content as a template and replaces
placeholders with values passed as a model (say a Map) to its constructor.
So the template can be a snippet of javascript, and the model just the
mapping id -> target.getMarkupId(). The same idea could be extended to a
template system as velocity or freemarker that does more than placeholder
filling, but I think that would be way too much. What I would like to know
is if someone has faced a similar concern, what solution did he find,
whether or not there is provided component with the proposed behavior
(although it would be trivial to implement a home brew one), and your
opinions in general.
Thank you in advance
Regards,
Carlos