I am trying to implement a โgeneralโ view where (part) of the displayed content is dependent on the URL. For instance.
If /somepath/somepage.xhtml points to a non-existent file, instead of going straight to 404 error, I want to try to extract the contents of /somepath/somepage.xhtml from the database using the general view /genericview.xhtml , where I have that something like:
<h:outputText value="#{genericViewBean.content_lg}" escape="false" />
which, if found under the bean, will display the contents of the database record from the tgenericcontent table, depending on the originally requested viewId:
webpath | content /somepath/somepage.xhtml | <p>This is a test</p> /someotherpath/someotherpage.xhtml | <p>A different test</p>
If the contents of the view are not found in this table, then standard 404 error will be returned.
The closest I got to clone /genericview.xhtml , changing only the path to the file (for example, to /somepath/somepage.xhtml ). But it gives me one exact copy of the file for each view, it is pretty messy and it doesnโt allow me to create a new URL just by adding an entry to my database.
How to get the same result without cloning /genericview.xhtml ?
(PS: I read about surfaces, but is there a simpler solution?)
source share