Facelet - Flushing component

When deploying a new EAR created from a machine with time settings different from that of the server where application is deployed, flushing of the JSF components can happen.

Logs will show the following error.

INFO: Facelet[/pages/menu.jspx] was modified @ 11:45:04 AM, flushing component applied @ 11:41:30 AM

The reason being, when ever a new request is made, server sees the page as modifed in future time stamp and starts compiling again. This causes the component tree to be created again, causing to lose all the state stored by the component.

To fix this add facelets.REFRESH_PERIOD to the web.xml.

REFRESH_PERIOD indicates, When a page is requested, what interval in seconds should the compiler check for changes. If you don't want the compiler to check for changes once the page is compiled, then use a value of -1. Setting a low refresh period helps during development to be able to edit pages in a running application.

web.xml, should look like this,




-1 indicates not to check for changes, since production servers it is safe to set this value.

For more,
https://facelets.dev.java.net/nonav/docs/dev/docbook.html#config-webapp-init

5 comments:

  1. This worked !!!.. Thanks

    Paul

    ReplyDelete
  2. Thanks.
    Great solution

    ReplyDelete
  3. Heh, +1 thanks, good catch.

    Cheers,
    M

    ReplyDelete
  4. Thanks a lot ..it works ...can u provide details of it ..why it happens and how does it is altered by writing the stated context.

    ReplyDelete
  5. You are the man! After 8 hours suffering I found your suggestion and it worked just like in my dreams! :) Thanks a lot

    ReplyDelete