Eclipse autocomplete (content assist) with facelets (jsf) and xhtml

前端 未结 10 1139
时光说笑
时光说笑 2020-11-27 02:45

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 m

相关标签:
10条回答
  • 2020-11-27 03:18

    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

    0 讨论(0)
  • 2020-11-27 03:23

    If you already installed JBoss Tools and still have this problem then uninstall JBoss tools. Restart eclipse. Make sure you don't have any JBoss tool lingering in your installed components list.

    Now go back to eclipse market.

    Install just: JBoss JSF, JBoss Richfaces and JBoss Visual Page Editor from the JBoss tool set. Do not download the whole package which comes with over 30+ tools. It is a bloated package and will slow down eclipse and unnecessary bloat your eclipse instance.

    Enable JSF facet with latest JSF implementation library. I'd recommend you to directly download it this jar from the official JSF website.

    Close eclipse.

    Open eclipse and create a new workspace.

    Import the project back into the new workspace.

    This worked for me!

    0 讨论(0)
  • 2020-11-27 03:25

    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.

    0 讨论(0)
  • 2020-11-27 03:25

    I had JBoss Tools installed and had JavaServer Faces facet configured for my project (in Eclipse Mars), but still didn't get any content assist from my .xhtml files. A solution not mentioned here is to choose Add JSF capabilities:

    Simply right click the project, and select Configure -> Add JSF Capabilities.

    It would look like the picture above but it would say Add JSF Capabilities instead of Remove JSF Capabilities. In the above picture, I had already added JSF capabilities.

    0 讨论(0)
  • 2020-11-27 03:29

    Suggestion: in eclipse Indigo(classic) and working with maven projects

    as the picture you can see bellow, can't find Project Facets selection that @mist suggested (because am haven't installed any plugins but m2e I guess).

    enter image description here

    so, I did this to solve that issue:

    Window >> Preference >> General >> Content Types >> XML >> Add file association (*.xhtml)

    this work not so well (content stoppage).

    0 讨论(0)
  • 2020-11-27 03:32

    If nothing work you must go to Preferences->General->Keys Then search for "content assist" if only one "content assist" for "when" "Editing Java source" exist copy this command. And set the binding to ctrl+space and when "Editing JSP Source".

    0 讨论(0)
提交回复
热议问题