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

How to activate eclipse (3.5, WTP) content in .xhtml pages for JSF tags (1.2) using facelets? It works in .jsp files, but not in xhtml.

I have a lot of google, and in many places (including MyFaces wiki) it says: "Eclipse cannot work with xhtml and facelets"

Since this works with .jsp files, I assume that there may be some mechanism by which this help can be activated.

I started working on a project that already has a large code base, so changing extensions is not an option. Additional plugins are also undesirable, but acceptable if nothing works.

(I ask a question to make sure that someone has not found a witty workaround for this problem - otherwise I know this is not possible)

+44
java eclipse facelets jsf
Jan 25 '10 at 22:37
source share
10 answers

I found the solution pretty quickly, asking a question (and an hour after I started to solve it):

Window > Preferences > General > Content Types > Text > JSP > Add (xhtml)

Makes files processed as jsp. Thus, when they are opened by the JSP editor, autocompletion of any tag library that has its own definitions in the .tld format ( <h: and <f , for example) works. Face tags and mask-only tags still don't work. Their .tld equivalents should be added somewhere in the projects. Facelet tld can be found here .

Another, more complex solution is described here .

+55
Jan 25 '10 at 23:01
source share

In Eclipse Indigo (3.7), adding * .xhtml to jsp does not work.

Adding a project grant solves the problem:

Right-click on the project -> Settings -> Project Boundaries -> Click on "JavaServer Faces", the version should most likely be 2.0.

Then he asks for the library , you can click "disconnect ..." because, most likely, you have already configured the banks. I do not have my library, so I ignored this part.

Screenshot: enter image description here

+48
Aug 30 '11 at 11:52
source share

Use JBoss Tools, this is what I use JSF + Facelets for my projects. This 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 version, which is CR1, since it is compatible with Eclipse 3.5, the final version should be soon, but CR1 is solid.

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

+7
Jan 26
source share

I had JBoss Tools installed and the JavaServer Faces facet was configured for my project (in Eclipse Mars), but it still did not get any information from my .xhtml files. A solution not mentioned here is to select "Add JSF Features":

Add JSF Features

Just right click on the project and select Configure -> Add JSF Capabilities.

It will be similar to the image above, but it says adding JSF features instead of removing JSF features. In the above image, I have already added the JSF features.

+2
Sep 02 '15 at 18:07
source share

Have you thought about MyEclipse ? It is not free, but it is a pretty good tool. It helped a lot when I was working with JSF.

+1
Jan 25
source share

Make sure you have an object namespace. So your html tag might look like this:

 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> 

I used in Eclipse Luna and primers 5.

+1
Jul 18 '14 at 15:53
source share

If nothing works, you should go to Preferences-> General-> Keys Then find “content help”, if only one “content help” for “when” “Edit Java source” exists, copy this command. And set the binding to ctrl + space and when "Editing the JSP source".

+1
Mar 10 '15 at 7:34
source share

If you have already installed JBoss Tools and still have this problem, uninstall JBoss tools. Restart the eclipse. Make sure you don’t have a JBoss tool lingering on the list of installed components.

Now return to the eclipse market.

Install only: JBoss JSF, JBoss Richfaces, and JBoss Visual Page Editor from the JBoss toolbox. Do not download the entire package that comes with more than 30 tools. This is a bloated package and will slow down the eclipse and unnecessary bloat of your eclipse instance.

Include a JSF facet with the latest JSF implementation library. I would advise you to directly download this jar from the official JSF website.

Close the eclipse.

Open eclipse and create a new workspace.

Return the project back to the new workspace.

It worked for me!

+1
Jun 10 '15 at 6:39
source share

I have the JBoss Tool installed to encode JSF. But in * .XHTML he did not show supporting information for ManagedBean. I have taken the following steps that work for me.

For my project, these steps worked.

1) Right-click on the project → Configure → Add JSF Features. Step-by-step procedure (Vailaaa Solution !!!). Go to the Xhtml file and try entering the code # {m ^ anagedBeans.HelloJSF ()} where (^) is sysmbol, you just need "Ctrl + space" Content Assist will work. here

+1
Jan 4 '16 at 3:51 on
source share

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

like the image you can see below, Project Facets cannot find the choice @mist suggested (because I have no plugins installed, but m2e I think).

enter image description here

So, I did this to solve this problem:

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

this work does not work so well (content stop).

0
Apr 23 '13 at 6:07
source share



All Articles