November 2006 saw the announcement by ICEsoft that their ICEfaces library of JSF components was being released under an open source license. This basically means that a lot of rich, often AJAX powered components became much more readily available for JSF application developers. Next to for example ADF Faces/MyFaces Trinidad and MyFaces Tomahawk, ICEfaces is another set to pick components from. Note however: ICEfaces does not mix freely within a JSF page with other JSF implementations. More on that later in this article. I decided to give ICEfaces a spin, watched the demos on and became convinced that the components were worth a second look. ICEfaces comes with a plugin for JDeveloper 10.1.3.x – since I am a happy JDeveloper user, that was to be my starting point. I will show you how to get a simple ICEfaces application running in no time at all (well, under 30 minutes). We will be using ICEfaces 1.5.2, which was released just days ago.
To get started with ICEfaces:
1. Go to, Register (if this is your first visit – note: registering is free) or Login (for a returning visitor)
2. Download ICEfaces-v1.5.2-JDeveloper.zip by pressing the download button. Save the zip-file just anywhere on your drive (c:\temp will do nicely)
3. Fire up JDeveloper 10.1.3.1. Go to Help, Check for Updates. Choose install from local file. Then browse and select the ICEfaces-v1.5.2-JDeveloper.zip file you have downloaded from ICEfaces. Click Next and subsequently Finish at the first opportunity.
4. JDeveloper needs to be restarted. When that is done, the plugin is installed and ready to rock. (you may check to see either if there are new Libraries predefined or if the menu option ICEfaces Integration has been added to the RMB menu on projects).
5. Let’s now create a new Application and a new Project.
6. Apparently, the ICEfaces Integration option in the Project’s RMB menu is only available for a Web Project. We can turn our project into a Web Project by creating a dummy JSF page: go to File, New and from Web Tier, JSF pick JSF JSP. Accept all defaults in the wizard that pops up.
7. Now when you go to the RMB menu on the MyFirstICEfaces project, the option ICEfaces Integration is enabled. Click on that option.
Two things happen: the ICEfaces libraries are added to your project and some ICEfaces configuration details are added to the web.xml file. Or at least: that is what I thought should happen. For my project, it did not happen. So I opened the web.xml file and pasted in the following elements:
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml<>
<servlet-name>uploadServlet</servlet-name>
<servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadHtml</url-pattern>
</servlet-mapping>
8. Add the ICEfaces Taglibrary to the project. Double click on the MyFirstICEfaces project (or select Edit Project Properties) and go to JSP Tag Libraries. Click the Add button. Select the ICEfaces Component Suite 1.5.2 to add to the project.
9. Let’s create our first JSF page with ICEfaces components. Go to File, New and from Web Tier, JSF choose the option JSF JSP. The Create JSF JSP Page wizard opens. Call the file for example ICEfacesTabsDemo.jspx. Select the ICEfaces Taglibrary along with the JSF Core and JSF Html libraries.
The WYSIWYG JSP Editor opens – with a pretty much blank screen as we have not yet added any content to the page. Go to the source view. Move the namespace declarations on t
he jsp:root element to the f:view element. Then remove all
tags outside f:view (the elements jsp:root, jsp:output and jsp:directive.page). Next, add our very first ICEfaces element: ice:outputText. The page now looks as follows:
<f:view xmlns:h=""
xmlns:f=""
xmlns:
<html>
<head>
<meta http-
<title>MyFirst ICEfaces</title>
</head>
<body>
<h:form>
<ice:outputLabel
</h:form>
</body>
</html>
</f:view>
We can also drag and drop ICEfaces components from the Component Palette onto the editor:
When we run this page, the browser opens up with the familiar:
A slightly more interesting ICEface component
<f:view xmlns:h=""
xmlns:f=""
xmlns:
<html>
<head>
<meta http-
<title>MyFirst ICEfaces</title>
<link href="css/xp/xp.css" rel="stylesheet" type="text/css"/>
</head>
<body><ice:form
<ice:panelTabSet>
<ice:panelTab
<ice:outputText
</ice:panelTab>
<ice:panelTab
<ice:outputText
</ice:panelTab>
<ice:panelTab
<ice:outputText
</ice:panelTab>
</ice:panelTabSet>
</ice:form></body>
</html>
</f:view>
Mixing ICEfaces with other JSF libraries such as ADF Faces/MyFaces Trinidad and Apache MyFaces Tomahawk
ICEfaces components cannot be used in the same page as JSF components from other libraries. This is caused by the special ViewHandler used by ICEfaces in conjunction with its Dynamic (Ajax) Rendering architecture. It’s a shame, since my main JSF library is usually ADF Faces, but some components in ICEfaces make for interesting complements to ADF Faces.
It is possible to combine ICEfaces and other JSF implementations in the same web application. That means we can have pages containing a mix of ADF Faces and MyFaces Tomahawk for example as well as pages based in ICEfaces components. It has been suggested that using (I)FRAMES this opens up possibilities of still combining ADF Faces and ICEfaces in what at least appears to be a single page… It is also quite possible to open up pop-up window from an ADF Faces page that is based on ICEfaces and displays in the data context and using the underlying data as the ADF Faces page.
Note that the ICEfaces Faces Servlet is also mapped to the iface url extension (for example). That allows us eventually to distinguish between jspx and iface which in turn makes it possible to mix in one web application both ICEfaces pages and for example pages built using ADF Faces or Apache MyFaces Tomahawk.
Resources
ICEfaces Tutorials: .
rob_gar_esp,
Looks like your css style sheets are missing. You have to include it. check out the examples on component suite
hth,
Hemanth
Hi,
I have a problem with CSS, the page works as expected but the actual tabs don’t appear, I only see three links in a row that work as expected, but don’t actually look like tabs. What can I do?
Thanks!
Hi HayrolR under wich version of jdev are you?
Hello again guys, I already resolve my problem … I had downloaded three .zip for the Jdeveloper integration (today): ICEfaces-1.6.1-bin.zip, ICEfaces-1.6.1-libs-JDeveloper.zip and ICEfaces-JDeveloper-IDE-v2.0.0.zip, but only installed the first two .zip on the JDeveloper extension becouse I belived that there could be a error due to versions problem. After I got several errors, and no solutions found, then I decided to install the ICEfaces-JDeveloper-IDE-v2.0.0.zip update and after the restart I did can see the “ICEface Integration …” feature in the right context menu of the proyect. More good notices, the Integration did what it’s supposed to do … add the ICEFaces libraries and components, and also write some code to my web.xml (I already had erased all the content for this file to see what code would be generated. Finally, my application works fine. Note: remember that I’m using JDev 10.1.3.3 and the ICEfaces files mentiones above.
Hey, nice example … but I’m getting the lame “500 Internal Server Error – Servlet error: Session expired”
I found an article about a OC4J bug related to the OC4J “forward”:
I already tried with web.xml version of the article (with some changes for the example) but I still getting errors.
I’m trying with JDeveloper 10.1.3.3 and ICEfaces 1.6.0.1 .. everything goes ok … (the only rare is that I can’t see the “Iceface Integration…” option on the project context menu, but I did all the work manually.
Can anybody give me a hand on this problem?.
Thanks in advance.
For those of you that get the “Failed to execute JSP lifecycle” error. If you replace everything in your web.xml file with what is in this tutorial then it will work. More specifically the differences in this tutorial and what were in my web.xml was…
My Computer:
Faces Servlet
*.jspx
Persistent Faces Servlet
/faces/*
This tutorial:
Persistent Faces Servlet
*.jspx
Faces Servlet
/faces/*
If I update these servlet-mapping’s it works as well.
I tried the steps in this tutorial with JDev 10.1.3.2 and IceFaces 1.6.0 and it didn’t work. For some reason I didn’t get the IceFaces Components taglib to register itself with JDeveloper, nor did I see the Enable IceFaces menu option in the RBM. With JDev 10.1.3.3 and IceFaces 1.6.0 all is working accordingly to the tutorial.
Wouter van Reeven
AMIS
Thanks Amis,
This guide is really clear and useful to get started with IceFaces, it is what I really needed!
Regards,
Rob
I will make my sample application available for download; those unfortunate among you who could not get it to work can try it with that one.
James,
In all fairness: that is what I surmised to be possible. I have not actually tried that out – it was on the list, but along with too many other things. I hope to give it a try one of these days and post the results on the weblog.
Lucas
You say at the end of your article that it is possible to combine ICEFaces with other JSF implementations within the same application. Do you have any experience of this, or happen to know whether this is only possible with certain JSF implementations? I’d like to be able to use ICEFaces along with Infragistics NetAdvantage components. I tried to adjust the url mappings in web.xml so that some pages could bypass the ICEFaces servlet and use the other JSF components. I didn’t manage to get ICEFaces out of the loop though – it always managed to hook a bit of its own framework code into my otherwise ICE-free page, causing it to fail.
Thanks.
I tried on jdeveloper but no luck.
When the project is enabled for iceFaces it changes my web.xml automatically. The servlet mapping for /faces/* is changed from “Faces Servlet” to “Persistent Faces Servlet” but in the sample above it is pointing to “Faces Servlet”. Does “Persistent Faces Servlet” extends “Faces Servlet”.
Thanks
I downloaded Jdev 10.1.3, icefaces 1.5.2 and followed your tutorial but when I run my application I get
500 Internal Server Error
Servlet error: Error instantiating servlet ‘Persistent Faces Servlet’. Servlet class com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet not found in …
What am I doing wrong?
Thanks
Dear writer,
I’ve tryed your demo but is not working with jdeveloper 10.1.3.2, I get the following error:
SEVERE: Failed to execute JSP lifecycle.
javax.servlet.jsp.JspException: com.sun.faces.context.FacesContextImpl
at com.sun.faces.taglib.html_basic.FormTag.doStartTag(FormTag.java:355)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:162)
….
Any help would be appreciated,
Thx