facelets.BUILD_BEFORE_RESTORE brokenness
I have finally had some time to sit down and figure out why submitted form data was disappearing when there were form validation errors. I tracked it down to facelets.BUILD_BEFORE_RESTORE, yet another one of Facelets completely undocumented features.
You may be wondering why I had it enabled in the first place, since I didn’t read the documentation that doesn’t exist. Well, I’m dealing with a few sizable forms and a pretty small heap, and according to this Facelets enhancement, I would get a magical 30-60% memory savings. Great, except it breaks everything.
BUILD_BEFORE_RESTORE seems to go back to 2006, when it was added to save on saved state size. 10k down to 600 bytes sure sounds like a big deal, except it breaks everything.
I’m not the first to notice this, and people have been having problems with it ever since:
- net.java.dev.facelets.users [Facelets] BUILD_BEFORE_RESTORE failure
- net.java.dev.facelets.dev CACHE_VEW_ROOT=false and BUILD_BEFORE_RESTORE=true
- facelets.BUILD_BEFORE_RESTORE breaks h:commandButton in seam
- No saved view state
Similar behavior was noted and fixed in MyFaces, but it was related to UIInput. Maybe the mechanism is similar.
So, I went back and took out the web.xml mods. Mojarra didn’t like this. It didn’t break, but it felt it necessary to recommend that I break it back to where it was:
WARNING: facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE is set to 'true' but facelets.BUILD_BEFORE_RESTORE is set to 'false' or unset. To use facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE you must also set facelets.BUILD_BEFORE_RESTORE to 'true'!
Sweet. facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE is true by default, so you need to go back into your web.xml and disable it if you don’t want to see this nagging message all of the time. If you work in a team, you almost certainly want to squelch this message so someone who isn’t in the know doesn’t go in and break everything because the machine told them to.

facelets.BUILD_BEFORE_RESTORE brokenness by cum grano salis — nobody likes a clever bastard, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.

Leave a Reply
You must be logged in to post a comment.