XHTML, Facelets, and NetBeans IDE

I was trying to do the Facelets tutorial in NetBeans IDE, and the tutorial calls for lots of XHTML files. Unfortunately, NetBeans makes it very hard to create XHTML pages with the .xhtml suffix.

First I had to actually find the XHTML template. It's not under Web, which is strange because HTML is there. After searching (OK, Geertjan told me), I found it in the Other category. Problem solved, right? Wrong.

The XHTML File Wizard doesn't let you specify the extension and automatically gives an XHTML file an .html extension, although it correctly recognizes it as an XML file and not a regular HTML file.

So the only way to really do this is to register the .xhtml extension as belonging to XML files. Choose Tools > Options > Advanced Options > IDE Configuration > System > Object Types > XML Objects and add .xhtml to the Extension and MIME Types category. (Side note - this setting really needs to get promoted to the main Options panel. It's one I use quite a bit and it's terribly buried in the Advanced Options. Actually, I'd rather be able to right-click any unrecognized file and choose Treat As... to register the extension with an object type.)

Now that the extension's registered, use the Other > Empty File template. This is the only template that will allow you to specify an extension. Give the file the .xhtml extension and it'll show up correctly as a file, although not with any of the skeleton code. It'll just be an empty file. Better than nothing, though.

BTW - if you're trying to do facelets in NetBeans IDE, it's not really easy. There's no code completion in the XHTML files, since schema-based code completion hasn't been implemented yet. If you use jspx files, it's supposed to work, but last I looked at it code completion wasn't working there either. Check out Mark Overdij's blog for a quick run-through of getting it going.

Comments:

Or... you could use the "Turn Into" module that I blogged about today...

Posted by Geertjan on May 31, 2006 at 09:51 AM CEST #

Vote for Facelets support in NetBeans 5.5 at http://www.netbeans.org/issues/show_bug.cgi?id=72556

Posted by Marcel Overdijk on May 31, 2006 at 12:45 PM CEST #

Post a Comment:
Comments are closed for this entry.
About

johnc

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today