views:

2969

answers:

3

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)

+6  A: 

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.

Bozho
eh.. a downvote? this worked for me perfetclty well. Explain why the downvote.
Bozho
@Bozho Good job (+1). I do not understand why someone gives you downvote.
Arthur Ronald F D Garcia
Maybe he was angry, that you answered your own question ;-)By the way, It worked for me as well! (+1)
Nils Schmidt
A: 

Have you thought about MyEclipse? It isn't free, but it is a pretty nice tool. It helped a lot when I developed with JSF.

prometheus
I haven't considered it for two reasons: 1. it's not free 2. the last time I evaluated it it was so buggy I had to reinstall eclipse in a while. True it was a long time ago, but stil..
Bozho
+3  A: 

Use JBoss Tools, it is what I use for my JSF+Facelets projects. It is the best you can get if you need to work with this technology.

http://www.jboss.org/tools

I recommend using the latest candidate release which is CR1 as it is the one compatible with Eclipse 3.5, the final version should be out soon but CR1 is rock solid.

http://in.relation.to/Bloggers/JBossTools31CR1Released

kpolice
good. But is it certainly working with .xhtml extension?Anyway, my preferred solution is the non-additional-plugin one
Bozho
yes it works with xhtml out of the box and a lot more things that are useful if you do JSF development, including any tag library, even custom facelets tags.
kpolice
since I use SpringSource Tool Suite, it feels strange if I install JBoss's and SpringSource's tools in the same installation =)) I sure hope it will work.
Hendy Irawan