aspose file tools*
The moose likes JSF and the fly likes Programtic validation of JSF 2.0 pages during a build? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Programtic validation of JSF 2.0 pages during a build?" Watch "Programtic validation of JSF 2.0 pages during a build?" New topic
Author

Programtic validation of JSF 2.0 pages during a build?

Jeffrey Getzin
Greenhorn

Joined: Feb 18, 2011
Posts: 3
Hi,

We have a build process that uses Apache Ant to build our WAR. Along the way, it compiles the JSP, which has the side benefit of revealing any errors in our JSP files at compile time instead of at runtime.

Now we're starting to use JSF 2.0, and one of the things I'm starting to realize is that there does not seem to be any way to perform this same kind of validation at build time for JSF files. Am I mistaken? I've been searching the web for a fair bit of time now with little results.

Certainly, it must be achievable. We use MyEclipse to develop, and for all its flaws, MyEclpse is able to do some rudimentary validation of our JSF 2.0 files. So surely, there must be a method out there. (And don't call me Shirley!)

Anybody know of any such mechanism(s)?

Thanks,

Jeff
Jeffrey Getzin
Greenhorn

Joined: Feb 18, 2011
Posts: 3
Oh man, don't you hate when you make a typo in a message title? :-)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19

Well, I, of course, never maek mistakes.

This is an interesting question. The preferred format JSF views are XML, so an XML validator can catch a lot of that kind of stuff at edit time.

However, where I usually get stung is in the EL parts, and EL has the same liability as JavaScript, Ruby, Python and other "Git 'R Dun!" interpreted languages. You don't REALLY know if everything's properly defined until you execute it. Which means, of course, that instead of embarrassing you back in development as management screams "It is ready yet? All You Have To Do Is...", you can speed the code into production and have it explode spectacularly in front of the whole world on the 15th of March after having run perfectly for a month.

Still, I'm sure people are working on this, so hopefully we'll see some contributions here.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jeffrey Getzin
Greenhorn

Joined: Feb 18, 2011
Posts: 3
Well, I know it can be done because, as I mentioned, the latest version of MyEclipse does an adequate job of catching most errors. (It's got some bugs still, but it's only a milestone release.)

I'm particularly worried not about syntax, but about class resolution. What if someone forgets to check in a Java managed bean file and the JSF page references that bean? A simple XML validator won't catch that, and neither would a mundane EL validator. To validate that, you'd actually need to match all the symbol references in the EL to all the available classes and methods and fields in the classpath!

Jeff
 
 
subject: Programtic validation of JSF 2.0 pages during a build?