In current project I need to create a panel that will contain an HTML content created by the user elsewhere in the application. This content can be easily inserted like this:
<h:outputText value="#{myBean.dynamicHTMLContent}" escape="false"/>
An example content:
<p>User text</p>
Now we need to give the user more freedom and allow him to use tokens in the HTML code that will be resolved by the application later:
<p>User text</p><p>User image: {niceImage}</p>
The application parses user content in myBean.dynamicHTMLContent and replaces {niceImage(param)} with
<a4j:mediaOutput element="img" createContent="{myBean.generateNiceImage}"/>
This is already a facelet snippet and cannot be evaluated and rendered in h:outputText.
I was looking for a good way to include this kind of dynamic content within a facelet at the stage when EL expressions are not yet evaluated. Something like
<ui:include src="src"/>
but for dynamic components would be the best solution.
Any ideas?
Eventually I took the easy way by replacing all custom (curly braces) tokens in the user HTML with corresponding JSF elements and generating a temporary
ui:compositionfacelet file:and in the parent facelet: