Hot republishing/deploying of static xhtml files i

2019-02-19 15:26发布

I'm noticing a lot of issues operating the "hot deploying" of JSF pages in the following environment:

  1. Eclipse Indigo(latest version)
  2. Tomcat 5.5
  3. JSF 1.2
  4. Facelets View Handler

I noticed that, if I modify an already rendered xhtml page (for example the CSS style of an element) and then re-publish(through Eclipse or manually copying the xhtml file inside Tomcat) this page (maintaining the servlet container up), it doesn't show me the current changes.

I also, in vain, setup the following configuration on my web application:

<Context 
    docBase="mywebapp" 
    path="/mywebapp" 
    reloadable="true" 
    cachingAllowed="false">

My last tought is that the Restore-View Phase of a typical JSF page processing, does not check if the client-view (the xhtml page of course) has changed from the last time it has been loaded in the FacesContext.

If so, how can i force the building of a new UIViewRoot object for each submitted request??

I'm a lot frustrating in restarting the tomcat server for each change in jsf pages.

Thanks a lot for your support.

1条回答
做个烂人
2楼-- · 2019-02-19 15:58

Try adding the following to your web.xml config file:

  <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>1</param-value>
  </context-param>

It tells JSF to re-render the Facelet. See how I put "1". In a Prod environment you would always put "-1" to disable this feature, since the facelets shouldn't be changing in a Prod environment.

You also need to make sure you can Hot Deploy class and JSP resources. You can find how to do that here:

http://ducquoc.wordpress.com/2010/11/06/eclipse-wtp-tomcat-hot-deploy/

查看更多
登录 后发表回答