28th Mar, 2009

Tutorial: How to Setup Icefaces for JBoss 5.0 in Eclipse

This tutorial will show how to setup an Icefaces development environment in Eclipse for Jboss 5.0. I will be using the newest GM versions of Icefaces (1.7.2-SP1), Eclipse (3.4.2), and Jboss (5.0.1).

Download the Stuff

First, lets get Icefaces here. Notice we will not be downloading the libraries, as they are included in the Eclipse Plugin.

Next lets download Eclipse here. Note you will need to have a Java JDK installed. You can get that here.

Lastly, lets get the Jboss Application Server here.

Install Applications

Extract all three of these somewhere. I extracted them into C: as seen here:

Open eclipse and goto the help menu->Software Updates… From here hit the Available Software tab. Click the add site button and then the Local… button. Direct it to where you extracted the Icefaces Eclipse Plugin. Should end up looking like this:

Click install and agree to the terms. It will install and restart Eclipse. Last thing before we get started is to add our server. In Eclipse goto the Window menu->Preferences. Expand Server->Runtime Environment. Click Add… Expand Jboss and select Jboss v5.0. Click next and browse to where you extracted Jboss.

Create Icefaces Project

We are now ready to start creating a new Icefaces project. Goto the file menu->New->Dynamic Web Project. Give it a project name. Set the Target Runtime to the server we created in the last step. You can leave Dynmaic Web Module version at 2.5 Changed the configuration to an Icefaces Project.

Click Next. Change Content Directory to ‘web’ since this is more popular.

Click Next. Select Server Supplied JSF radio button. Deploy only the Icefaces Libraries as Jboss AS has the rest already included. Including the others will throw errors when you deploy your web application. You can leave the rest. Click Next and Finish.

You now have have your project created. Before we can start developing, one more thing to configure. We need to add a line to the faces-config.xml in the WEB-INF folder. Without it you will receive errors when deploying. Your face-config.xml should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application> 
	<view-handler> 
		com.icesoft.faces.facelets.D2DFaceletViewHandler 
	</view-handler> 
</application> 
</faces-config>

After making the changes save the file.

Test if it Works

We are now ready to add a new test page. Right click on the web folder and New->JSP. Lets name the new file ‘test.jspx’. Click Next. Select New IceFaces JSPX File (.jspx).

Click finish. We can now deploy and test if it works. Right click the project and select Run As->Run on Server. It should already be set to the server we created earlier:

You can click next and make any configuration changes if you wish. Click finish when you are ready. Notice it will open to the default root. Open a browser and enter this url if you used the same configurations as I did (default).

http://localhost:8080/IcefacesTutorial/test.iface

If everything worked as expected you should have received this page:

Hope this helped. If you got lost or just want to check out the files, here is the Eclipse project used in the tutorial. Happy coding!

Responses

Very very thanks from Colombia

Much thanks. Was hopelessly fighting JBoss AS + Netbeans + ICEfaces before I found this.

What do I need to do if I want to work with apache tomcat 6.0 instead of jboss

Very much appreciate your efforts in putting down these steps. Helped me save a night-out in trying to deploy icefaces app on jboss 5. Thanks very much.

Some of steps are not applicable for Eclipse Galileo on jboss 5.1 although the documentation that comes with the icefaces plugin might fill that gap.

Leave a response

Your response:

Categories