4

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>
    
Community
  • 1
  • 1
braveterry
  • 3,724
  • 8
  • 47
  • 59
  • 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 Feb 22 '10 at 19:11
  • 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 Feb 22 '10 at 22:11
  • if BalusC's solution doesn't work, you might take a look here http://stackoverflow.com/questions/2136218/eclipse-autocomplete-content-assist-with-facelets-jsf-and-xhtml/2136362#2136362 - it is about eclipse, but the linked articles/tld are probably applicable to netbeans as well. – Bozho Feb 23 '10 at 08:03
  • 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 Feb 23 '10 at 15:36

1 Answers1

1

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).

Awano
  • 161
  • 2
  • 6
  • I added the "JSF 1.2 + Facelets 1.1.14 library" and it had no affect. I also tried switching to the text/xhtml MIME type. It also had no affect. Thanks! – braveterry Feb 23 '10 at 14:57
  • Do you use the official Netbeans 6.8? It seems they were some bugs on xhtml autocompletion in intermediary builds. – Awano Feb 24 '10 at 08:46
  • As far as I know. I'm running NetBeans IDE 6.8 (Build 200912041610) – braveterry Feb 24 '10 at 16:50
  • THANK YOU! Our team has named our Facelets files with the .JSF extension and I was pulling my hair out trying to figure out why I didn't get any code completion. – roufamatic Apr 14 '10 at 16:47