Dynamic markup in Wicket
Is it possible to开发者_高级运维 generate the markup for a MarkupContainer
dynamically, i.e. without storing an HTML file for it?
I thought about reading the markup as a plain string from the database to offer CMS-like functionality.
Interesting question and I'm not sure if it is possible, but my guess would be to start off looking at the IMarkupLoader and IMarkupResourceStreamProvider interfaces and implementing classes and see how far you get from there.
I'd be interested in anything you find / implement that actually gets this done!
Another (simpler) way to do it would be to use a label with disabled markup escaping :
Label<String> label = new Label<String>("id", "<a href='....'><span>foo<em>bar</em></span></a>");
label.setEscapeModelStrings(false);
add(label);
Be careful though, as this might lead to security breaches (HTML/JS injection).
精彩评论