4
votes

I'd like to enable code completion for facelets + JSF 1.2 in NetBeans 6.8. I'd prefer to enable it for a free-form project that I build using my own Ant build.xml, but I see no options to enable that, so I'm willing to go with a "Web Application with Existing Sources".

Sorry for all of the screen-shots. I just want to show what I did.

Project Setup

Choose a Project dialog

Name & Location dialog

Server & Settings dialog

Existing Sources & Libraries dialog

Project Configuration Frameworks dialog with Libraries tab selected

Frameworks dialog with Configuration tab selected

After setup and configuration, code-completion within facelets still doesn't work.
Showing editor with failed code-completion

Am I missing something? Am I going about this in the wrong way?

Solution

Here's what I ended up doing:

  1. I switched from a Standard Java project to a Web project (duh!)
  2. I took Awano's advice and switched the MIME type for xhtml files back to text/xhtml.
  3. I added the tld file from the facelets site to the meta-inf directory in the jsf-facelets.jar and included it in my project.
  4. I added the rendered attribute to the fragment tag in the jsf-ui.tld file. It was missing for some reason:

    <attribute>
        <name>rendered</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <description>Renders the contents of this tag if the attribute resolves to true.</description>
    </attribute>
    
1
I don't do Netbeans, so I have really no idea. But similar problem exist in Eclipse. All you need to do in Eclipse is to associate *.xhtml files with the JSP editor (which by default only runs on *.jsp, *.jspx and so on). See if similar setting exist in Netbeans. Good luck.BalusC
Thanks for the suggestion. I fiddled with changing the associated mime type, but that had no affect on code completion. (It did affect tag matching and code formatting, though.)braveterry
if BalusC's solution doesn't work, you might take a look here stackoverflow.com/questions/2136218/… - it is about eclipse, but the linked articles/tld are probably applicable to netbeans as well.Bozho
Bozho, I took a look at the question you linked to. I tried manually referencing the TLD files, but it had no affect. I'll keep poking around.braveterry

1 Answers

1
votes

Did you add the facelet libs in the libraries of your project properties? Otherwise check that in Tools / Options / Miscellaneous / Files that xhtml is associated with MIME XHTML (text/xhtml).