I have my sites content saved as plain html in my database. It is only simple data no input from the user is possible.
I like to show the content as follows:
if content.jsf?Sitename gets called i want to show the content of the site “Sitename”.
I already have the content saved in my ApplicationScoped Bean.
content.xhtml:
<ui:composition template="template/common/commonLayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="content">
//show content here
</ui:define>
</ui:composition>
I want to do this because, i’d like to add new pages/subpages without redeploying the whole application.
How can I make this work?
You can use
<h:outputText escape="false">to show plain HTML from a bean property.If you want to parameterize it, use EL 2.2 feature of passing method arguments, or use a
Map.Beware of potential XSS attack holes if this concerns user-controlled data though.