I've been working with JSF for nearly three years now and still after these years there is one problem that bothers me everyday! The problem is related to working with an exploded web application deployment. When editing a jsp/xhtml file you want to see the changes done to it without having to restart you webapp server.
My usual way of forcing the faces/facelets servlet to recompile/re render the changed content has been to:
1. Force browser refresh by ctrl-f5
2. Force browser refresh by loading a different page and then going back to the page that changed
3. Hitting refresh several times
4. Clear browser cache
5. Load page in a different browser
When none of the above work the only way to make the changes appear is to stop Tomcat and restart. After upgrading to the latest version of myfaces/richfaces/facelets I cannot get any of the "regular" force refresh solutions to work, and I'm stuck developing the view parts of my application by stopping and starting tomcat all the time.
This is VERY time consuming and not a very good way to work at all! I've been searching a bit for documentation on the matter, but I cannot seem to find much of it..
I am using MyEclipse for the exploded deployment part of this, and I can physically see that the XHTML pages have been updated with the changes I do under tomcat. However they never get recompiled it seems.
1. Is this a common problem for the regular JSF developer?
2. Are there good ways of circumventing this problem? Is there a way to make facelets/faces servlet always recompile the view?
3. May this problem be related to a specific web application/tomcat version?
Myfaces 1.1.5 / Tomahawk 1.1.6
web.xml settings that I think may impact my problem:
<context-param> <param-name>facelets.REFRESH_PERIOD</param-name> <param-value>0</param-value> </context-param> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> <init-param> <param-name>enable-cache</param-name> <param-value>false</param-value> </init-param> </filter>
Typical subview page:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a4j="http://richfaces.org/a4j"> <ui:composition template="/templates/myTemplate.xhtml"> <ui:define name="body"> my content </ui:define> </ui:composition> </jsp:root>
On a related note:
Why do the facelets servlet decide to render out the jsp:root element when rendering the page? I thought it should not render anything outside the ui:composition tag.