How to activate eclipse (3.5, WTP) content assist in .xhtml pages for JSF (1.2) tags, using facelets? It works in .jsp files, but not xhtml.
I google a lot, and in many places (including MyFaces wiki) it is said - "Eclipse can't work with xhtml and facelets"
Since this works with .jsp files, I assume there might be some mechanism with which to activate that content assist.
I started working on a project, which has already a large codebase, so changing the extensions is not an option. Additional plugins are aslo undesirable, but acceptable if nothing else works.
(I'm asking the question to verify if someone hasn't found a witty workaround to this issue - otherwise I know it's not possible)
Found the solution pretty quickly after asking the question (and an hour after I started attempting to solve it):
Window > Preferences > General > Content Types > Text > JSP > Add (xhtml)
Makes the files be treated as jsp ones. Thus when they are opened with the JSP editor, the autocomplete of any tag library that has its definitions in .tld
format (<h:
and <f
for example) works. Facelets, and facelets-only tags still don't work. Their .tld
equivalents should be added somewhere in the projects. Facelet's tld can be found here.
Another, a bit more complex solution is described here.
In Eclipse Indigo (3.7) adding *.xhtml as a jsp does not work.
Adding a project facet solves the issue:
Right click on the project -> Preferences -> Project Facets -> Click on "JavaServer Faces", version should most probably be 2.0.
Then it asks for a library, you can click on "disable...", because most probably you already would have the jars configured. I don't have mine as a library so I ignored that part.
Screenshot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With