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 the Author

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

Comments

avatar
21 Comment threads
3 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
21 Comment authors
José ApYoshua Lino TroncosoClintJCLSaurabhDollar tree coupons Recent comment authors
newest oldest most voted
José Ap
Guest
José Ap

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
Guest
Yoshua Lino Troncoso

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
Guest
ClintJCL

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

Saurabh
Guest
Saurabh

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
Guest
Dollar tree coupons

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

karen
Guest
karen

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
Guest
Rashid Mahmood

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
Guest
sathish.pk

very nice … doubts are cleared… thanks..

Mark
Guest
Mark

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
Guest
Alan

Eres lo maximo cholito!!!
love u

Tugrul
Guest
Tugrul

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

Japan Trivedi
Guest
Japan Trivedi

Perfect solution. Thanks.

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

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

Tiago Wanke Marques
Guest
Tiago Wanke Marques

Tanks, works perfectly.

Luis Eduardo
Guest
Luis Eduardo

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

trackback
Eclipse code assist | ?brahim DEM?R's web site

[…] Buradan yard?m ald?m […]

Kalibu
Guest
Kalibu

Excelent, thanks!

cobaasta
Guest
cobaasta

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…

trackback
JSF 2.0 hello world example

[…] Eclipse IDE : .xhtml code assist is not working for JSF tag This article was posted in JSF2 category. Oracle Magazine – Free Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for Java's developers and DBAs, and more. […]

Fábio
Guest
Fábio

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
Guest
Daniel

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.