Friday, May 7, 2010

Facelets and eclipse

Per default, eclipse does not recognize xhtml files, the default file extension for facelets. I.e., you don't have code completion and the jsf managed beans are not recognized either.

There is a solution:

In window->preferences you do 2 things...

1. In General->Content Types you choose text/jsp in the content types and add *.xhtml as a file association

2. In General->Editors->File Associations select the *.xhtml file type and add th JSP Editor as the Default

I'm not sure if you really need to put the TLD in WEB-INF. (at least with eclipse 3.5) It workds without for me.
now just add the TLD to WEB-INF dir of your project and hey presto tag:completion now works for xhtml files.

I picked this from Andrew Lovell, thanks a lot.

No comments:

Post a Comment