Sunday, August 2, 2009

Richfaces or Trinidad with Facelets

I upgraded existing project from Java 1.4 to Java 1.5, JSF 1.1 to JSF 1.2, myfaces to sun ri... and decided to leverage a framework providing AJAX for JSF. The first I tried was richfaces. But it worked unstable and I spent 2 days trying to find a reason for it. Then I tried to use trinidad. It was the same. The framework worked but very unstable. For example. I opened a jsf page, if I clicked on a ajaxfied button just immediately after page appeared, then button worked OK. But if I clicked on the button after a while, then the button didn't work, the relevant page part was not updated! It looked like a magick in work. Then I noticed a very strange message which I noticed long time ago but didn't pay any attention to it. The message was "INFO: Facelet[/page/blah.xhtml] was modified @ 14:23:24 AM, flushing component applied...". A quick investigation revealed a root of my problem! It turned out that time in a virtual machine I used as a place for application server was 3 hours less then current time! And so file creation time of files in WAR-file was greater than time in the virtual machine. It looked like facelets framework had some strange algorithm based on current time to reload modified files (and flush components tree). Having set facelets.REFRESH_PERIOD context parameter in web.xml I solved the problem. Both richfaces and trinidad worked fine after that.

No comments:

Post a Comment