Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p><em>1: Whenever a new page has to be added/removed: manipulate the files in the classpath (e.g. remove or add a file to the .war file)</em></p> </blockquote> <p>This is definitely possible if the WAR is expanded. I am not sure about Jetty, but it works for me with Mojarra 2.x on Tomcat 7 and Glassfish 3. Just writing the file to the expanded WAR folder the usual Java IO way suffices.</p> <pre><code>File file = new File(servletContext.getRealPath("/foo.xhtml")); if (!file.exists()) { OutputStream output = new FileOutputStream(file); try { output.write(bytes); // Can be bytes from DB. } finally { output.close(); } } </code></pre> <p>This needs to be executed <strong>before</strong> the <code>FacesServlet</code> kicks in. A <code>Filter</code> is a perfect place. See also this related answer: </p> <ul> <li><a href="https://stackoverflow.com/questions/3510614/how-to-create-dynamic-jsf-1-2-form-fields/3511785#3511785">How to create dynamic JSF form fields</a></li> </ul> <hr> <blockquote> <p><em>2: Extending the classpath of the webapplication so it will be able to get files from an at runtime defined location (i.e. /tmp or directly using a database connection)</em></p> </blockquote> <p>You can package Facelets files in a JAR file and put it in the classpath and provide a Facelets <a href="http://download.oracle.com/javaee/6/api/javax/faces/view/facelets/ResourceResolver.html" rel="nofollow noreferrer"><code>ResourceResolver</code></a> which serves the files from the JAR on when no match is found in WAR. You can find complete code examples in the following answers:</p> <ul> <li><a href="https://stackoverflow.com/questions/5379995/how-to-share-a-jsf-error-page-between-multiple-wars/5380452#5380452">how to share a jsf error page between multiple wars</a></li> <li><a href="https://stackoverflow.com/questions/6199458/how-to-create-a-modular-jsf-2-0-application/6201044#6201044">How to create a modular JSF 2.0 application?</a></li> </ul> <hr> <blockquote> <p><em>3: Provide JSF with a way to find resources another way ( this doesn't seem possible? )</em></p> </blockquote> <p>You've plenty of play room in the custom <code>ResourceResolver</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload