Verifying Facelets File Integrity During Build or Deployment

Is there a way to check Facelets files for errors during the build or deployment process?

I'm not looking for a solution that just checks Facelets files against their schema, but also checks for EL expressions. For example, if a property or method name is spelled incorrectly in an EL expression (for example, Value="#{controller.nme}" instead of value="#{controller.name}" ), this will only be detected during testing during fulfillment.

I am using JBoss 7.1.

+4
source share
2 answers

Theoretically, Eclipse plugins, such as WTP and JBosd, can do this, but today they only work in a complete IDE, and not as a separate command-line tool that can be called using Ant or Maven.

Worse, these tools have never been perfect. They always report tons of false positives, and usually their validation algorithms are usually years ago. The current version of WTP probably barely checks everything starting with Java EE 5 (perhaps it still misses some obscure features).

As a result, if you abandon an assembly based on this check, you probably can never deploy it. Even in the most carefully coded and fully valid web applications, the WTP and JBoss tools find it necessary to report hundreds or thousands of warnings and errors in large projects. IMHO completely useless to depend.

+4
source

This is a kind of chicken / egg problem. As you said yourself, many EL expressions can only be evaluated at runtime.

Keep in mind that EL includes much more than just names of properties and methods, it has different implicit objects ( params , facesContext , session , etc.) that are available in different contexts, and you can also add to it their own objects in various ways (other Facelets templates, beans, which may or may not be registered in the config files, and even in plain Java code, inserting objects into the view).

All this contributes to the creation of a very complex toolkit with this type of verification for you. I think the closest thing to what you want is to create your own JSF test cases for each page using JSFUnit and Arquillian and integrate them into your build. Since you are targeting JBoss 7, I believe this should be feasible.

+3
source

All Articles