Saturday May 03, 2008

RichFaces for NetBeans IDE 6.1 (Part 1)

Yesterday I met with Wouter van Reeven, here in San Francisco, who mentioned the RichFaces framework to me. In particular, people in a JBoss-oriented world are likely to want to use RichFaces (as well as ICEfaces, Seam, and Facelets). For ICEfaces, a NetBeans plugin exists (here), though it works in 6.0 only. I've tried it, it's a pretty cool thing: you get support both for traditional web applications and for Visual Web applications. I'm hoping they'll upgrade to 6.1 soon (shouldn't be hard, I expect they only have a dependency change to fix).

However, no such thing exists for RichFaces. What's the difference between ICEfaces and RichFaces? No idea. Didn't know they existed until yesterday. However, they piqued my interest because of AJAX, which is a theme at NetBeans Day on Monday. So I created some basic NetBeans support for RichFaces, based on a cool and simple example application that Wouter sent me today. Go here to download the new support I created and then read on to learn about what it can do for you:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=8934

Download that ZIP file, you will have two NBM files in the ZIP file, install them both in NetBeans IDE 6.1.

Now do the following:

  1. Create a new web application.

  2. Make sure to set GlassFish as your server, because this server bundles JSF libraries and RichFaces is an extension of JSF. If you want to use Tomcat or some other server, make sure JSF is available to the server in question.

  3. In the Frameworks panel, choose Java Server Faces AND RichFaces:

    Click Finish.

  4. Inspect the generated sources. In addition to your standard JSF application, you have the RichFaces JARs in the Libraries node, you have RichFaces entries in your web.xml, your welcomeJSF.jsp contains some RichFaces-specific code, and you have a managed JSF Java bean in a new package in your source structure, automatically registered in faces-config.xml. Here's the whole thing:

  5. Run the application and you have your first AJAX application via RichFaces:

    Notice that the text to the right of the field is automatically updated as you type in the field itself. That's AJAX, partial page refresh, faster response to the user, etc.

  6. Want to change the "skin" of the application? Drop this into the web.xml:

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>

    Run the app again and notice the "skin" is different:

Now continue learning about RichFaces via online resources. Next, I will create a palette that provides items that you can drag and drop into a JSP page, for RichFaces. However, I doubt I will ever create RichFaces support for Visual Web applications, because that's an area I have little knowledge (nor very much interest) in. If someone wants to help me, such as in the area of Visual Web, feel free to leave a message here and let me know!

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« May 2008 »
SunMonTueWedThuFriSat
    
2
5
7
16
20
22
25
28
       
Today