Develop Portlet (JSR168) with Icefaces

1. Add framework JSF in project properties.

Remember to uncheck library of JSF because we are using Icefaces.

2. In portlet.xml, change <portlet-class> to com.icesoft.faces.webapp.http.portlet.MainPortlet

3. In portlet.xml, add these in

<init-param>
<name>com.icesoft.faces.VIEW</name>
<value>/WEB-INF/jsp/view.iface</value>
</init-param>
<init-param>
<name>com.icesoft.faces.EDIT</name>
<value>/WEB-INF/jsp/edit.iface</value>
</init-param>
<init-param>
<name>com.icesoft.faces.HELP</name>
<value>/WEB-INF/jsp/help.iface</value>
</init-param>

4. In web.xml

The ICEfaces Servlets are registered as follows:

<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.BlockingServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>

The Servlet mappings are established as follows:

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jspx</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>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
com.icesoft.faces.util.event.servlet.ContextEventRepeater
</listener-class>
</listener>
<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>true</param-value>
</context-param>

5. Sample .jspx for 1.7 beta

<f:view xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<html>
<head>
<title>
ICEfaces Portlet Chat
</title>
</head>
<body>
<ice:portlet>
<ice:outputStyle href="/xmlhttp/css/xp/xp-portlet.css" />
<f:loadBundle basename=" " var="bundle"/>
<!-- Login/Logout -->
<ice:form>
<ice:outputText value="ICEFACES 1.7"/>
</ice:form>
</ice:portlet>
</body>
</html>
</f:view>

For 1.6

Remove <ice:portlet>

Put <ice:outputStyle> inside <ice:form>

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s