Main Tutorials

Eclipse IDE : .xhtml code assist is not working for JSF tag

Problem

Using Eclipse Helios (3.6) and developing JSF 2.0 web application. In .xhtml file, when i pressed on the “Ctrl + Space” combination keys to call the code assist for JSF tag, it prompts nothing? It look like the code assist for JSF tag is not working properly in the .xhtml file extension?

eclipse-jsf-support

Solution

In Eclipse project, you have to make sure the project is supported the WTP and JSF capabilities.

1. Right click on the project, choose properties, select “Project Facets“, make sure the “JavaServer Faces” is checked. Later, click on the “further configuration…” link to configure the JSF capabilities.

eclipse-jsf-support

2. Create an user library and include the JSF API and implementation library, jsf-api-xxx.jar and jsf-impl-xxx.jar. It will add the JSF capabilities to your project.

eclipse-jsf-support

3. Done, in .xhtml file, click on the “Ctrl + Space” keys again, now it prompts the JSF tag code assist properly. Furthermore, it add JSF visual editor to the web page editor as well.

eclipse-jsf-support

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
22 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
José Ap
6 years ago

Se for xhtml

Tente primeiro a opção 1 caso não der tente a 2

1) Vá em window, preferences, General, Content Type, no lado direito vá em text, depois em jsp, em baixo clique em add (File associations), adicione *.xhtml;

2) Vá em window, preferences, General, Editor, File Associations, procure por *.xhtml, add, escolha a opção JSP Editor;

Yoshua Lino Troncoso
7 years ago

He instalado el moonrise theme para tener el fondo oscuro y cuidar la vista un poco mas, pero me he encontrado con un problema.

Y es que no consigo a la hora de hacer el “Compare whith” que los cambios me aparezcan mas resaltados como antes.

He estado cambiando varias cosas en general text and fonts pero no he conseguido avances.

Si alguien puede orientarme. Gracias

ClintJCL
9 years ago

Didn’t work. Plus, it’s a maven project, so it needs to not be a faceted project.

Saurabh
10 years ago

Hello Mkyong,

I’m using Eclipse Kepler (downloaded latest version for : Eclipse IDE for Java EE Developers). I’m having JSF 1.2 added & alos *.xhtml is added in content type under HTML.

Still, code assist is not working for me in any of .xhtml. I’m using JSF 1.2 & JDK 1.7 on Windows 7 (64 bit).

Can you help me to get it working? Thanks.

Regards,
Saurabh

Dollar tree coupons
10 years ago

Hi there friends, its great post about educationand entirely
explained, keep it up all the time.

karen
10 years ago

My developer is trying to persuade me to move to
.net from PHP. I have always disliked the idea because of the costs.

But he’s tryiong none the less. I’ve been using WordPress on
various websites for about a year and am concerned about switching
to another platform. I have heard great things about blogengine.
net. Is there a way I can import all my wordpress posts into it?
Any help would be really appreciated!

Rashid Mahmood
11 years ago

hi,

I have the same problem. Actaully i am using myfaces 2.1.9 and not eclips mojarra jsf libs. In this case what to do? how tags will be appeared?

sathish.pk
11 years ago

very nice … doubts are cleared… thanks..

Mark
11 years ago

Where are the jsf-api-xxx.jar libraries? I’ve searched my entire user dir and I can’t find them.

find ~/ -name ‘jsf-api*’

Alan
11 years ago

Eres lo maximo cholito!!!
love u

Tugrul
11 years ago

Thx very much. Really good article. You give me a lot of time in my project.

Japan Trivedi
11 years ago

Perfect solution. Thanks.

http://www.zimbio.com/member/gamesd3/articles/shMcfECBFiY/New+PC+Game+Year+Diablo+3
11 years ago

Finally it out! May 15th! Been waiting for many years

Tiago Wanke Marques
12 years ago

Tanks, works perfectly.

Luis Eduardo
12 years ago

Thanks you’ve helped me a lot !! Now my future project at university will be easy to do.

Kalibu
12 years ago

Excelent, thanks!

cobaasta
13 years ago

Your solution did not work!
I had JSF code completion in Eclipse 3.5, but not in Eclipse 3.6.1.
Seems like Eclipse has past the prime and is only getting worse…

Fábio
13 years ago

Hi, Mkyong.

I just wanted to thank you very much!
I was searching for a decent solution for this problem 2 days after I started developing in JSF 2.0. After many fool bugs caused by typos in xHTML, which are hard and very time consuming to debug, I simply stopped everything until I find something that solve this serious inefficiency.

If I didn’t find your solution, I would really abandon Eclipse and would try NetBeans.

Thanks once more.

Daniel
13 years ago

Hi mkyong! I hope you’re fine.
I was following your tutorial step by step but finally I couldn’t do run the code assist for my XHTML.I’m using Eclipse Ganymede, JSF 2.0
Thanks in advance!

Daniel.

Dileep
11 years ago
Reply to  mkyong

Hi mkyong,
How to get the content assist of managed beans if i use more than multiple faces-config xml fils. Please help me…