This question is already answered here: JSF and automatic reload of xhtml files
However, as the question in the link above is specific to the WebLogic app server and there are several comments on what works on what app server (Glassfish, JBoss), but without mentioning Open Liberty, I throw in my two cents here:
For hot reload / dynamic update of a xhtml file, the xhtml file must be copied to the target (obviously) and the xhtml file must be recompiled.
In case of the OP, it seems that the second condition is not met.
In web.xml set the context parameter javax.faces.PROJECT_STAGE
to Development
with the following snippet:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
JSF 2.x caches xhtml pages (that is, the compiled xhtml pages). Setting javax.faces.PROJECT_STAGE
to DEVELOPMENT
disables the caching of xhtml pages, thus any changes an a xhtml file take effect immediately.
If you work with the Liberty Maven Plugin and start the server with mvn liberty:dev
, any changes of xhtml files are picked up and the changed files are copied to target/<your-app-name>/<path-to-xhtml-file>
If you run Open Liberty from an IDE like Eclipse, Intellij or Netbeans, you have to make sure that changed xhtml files are copied to the target.
In Open Liberty, you do not have to fiddle with javax.faces.REFRESH_PERIOD
, as it seems to be the case with some other app servers (see link above). If for any reason you have to do so, set javax.faces.REFRESH_PERIOD
to 0 or a low integer value.