JRebel 处理 /WebContent 文件夹更改。
问题是 Facelets 会进行缓存并且不会重新读取已更改的文件。要强制重新加载,请在中指定以下参数之一web.xml
.
JSF 2+(小面 2+):
<!-- Set the project stage to "Development", "UnitTest", "SystemTest", or "Production". -->
<!-- An optional parameter that makes troubleshooting development stage errors much easier. -->
<!-- You should remove this context parameter before deploying to production or override via Server's JNDI config! -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
这会自动将“Facelets 刷新周期”配置设置为 0,从而有效禁用 Facelets 缓存。
或者,如果您不想更改项目阶段,那么
<!-- Time in seconds that Facelets should be checked for changes since last request. A value of -1 disables auto-refresh. -->
<!-- You should remove this context parameter before deploying to production or use PROJECT_STAGE instead! -->
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
对于 Faces 4.xjavax.
前缀应该是jakarta.
相反,像这样jakarta.faces.PROJECT_STAGE
and jakarta.faces.FACELETS_REFRESH_PERIOD
.
For JSF 1.2(Facelets 1.x) 等效参数为:
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
有关 JSF 上下文参数的更多信息:http://docs.jboss.org/jbossas/6/JSF_Guide/en-US/html/jsf.reference.html#standard.config.params http://docs.jboss.org/jbossas/6/JSF_Guide/en-US/html/jsf.reference.html#standard.config.params
您的情况不需要该自定义资源解析器。该资源解析器只是从自定义文件系统文件夹获取 xhtml 文件的一种棘手方法。在你的例子中,JRebel 做到了这一点(甚至更多)。