Arise dead thread, arise...

A little thread necromancy here as I'm back onto getting some kind of ajax enabled faces component sets into my jetspeed portlets. I aplogize in adavance for the length of this posting.

I've been looking into richfaces and facelets, I followed the directions from this blog posting: http://sensiblerationalization.blogspot.com/2009/07/from-jsf-to-richfaces-to-richfaces.html and got the portlet running under jetspeed 2.2 (tomcat 6.0.2, JAVA 6) without incident.

My next step was to try taking the tree component from the full richfaces demo here: http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?tab=dnd&cid=2953530

(source can be downloaded from their svn here: http://anonsvn.jboss.org/repos/richfaces/tags/3.3.1.GA/samples/richfaces-demo/).

I picked up the source and copied the pieces required (backing bean classes, faces-config entries, image and properties files), and mixed them into my previous demo app (the simple form demo mentioned above). This mix and match is probably the source of the problems I'm about to describe as many of the classes involved are from Jboss and may not play nice under jetspeed.

Added a fragment to a psml to display the portlet.

The portlet renders correctly on the page, but any user intereaction with the elements of the tree causes a state error:

SEVERE: JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.phaseevent[source=com.sun.faces.lifecycle.lifecyclei...@1f02b4b] (using the 1.2_12 jsf-api and jsf-impl jars)

Or using myfaces-api and impl 1.2.5 :

SEVERE: An exception occurred
javax.faces.application.ViewExpiredException: /tree.xhtmlNo saved view state could be found for the view identifier: /tree.xhtml

The problem as I understand it is that the component Id is not getting stored (in the faces component tree?) on the server.

Relevant files:
++++++++++++++++++++++++++++++++++++++++++++
tree.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml";
     xmlns:ui="http://java.sun.com/jsf/facelets";
     xmlns:h="http://java.sun.com/jsf/html";
     xmlns:f="http://java.sun.com/jsf/core";
     xmlns:a4j="http://richfaces.org/a4j";
     xmlns:rich="http://richfaces.org/rich";>

   <style>
       .col1, .col2 {
           width:50%;
           vertical-align:top;
       }
       .rich-table-cell, .rich-table{
           border:none;
       }
       .indicatorPicture {
           width: 80px;
       }
   </style>
   <f:view >
       <rich:dragIndicator id="indicator1" >
           <f:facet name="single">
<h:graphicImage styleClass="indicatorPicture" value="/WEB-INF/images/{draggedImage}" />
           </f:facet>
       </rich:dragIndicator>
       <rich:dragIndicator id="indicator2" />
<h:form> <h:panelGrid columns="2" width="100%" columnClasses="col1,col2"> <rich:tree
                   ajaxKeys="#{null}"
                   style="width:300px"
nodeSelectListener="#{simpleTreeDndBean.processSelection}"
                   reRender="selectedNode"
ajaxSubmitSelection="true" switchType="client"
                   dragIndicator="indicator2"
                   value="#{simpleTreeDndBean.treeNode}"
                   var="item"
                   id="tree"
                   treeNodeVar="treeNode"
                   dropListener="#{simpleTreeDndBean.dropListener}"
nodeFace="#{treeNode.parent.parent == null ? 'node' : 'leaf'}"> <rich:treeNode type="node" acceptedTypes="pic" icon="#{treeNode.icon}" iconLeaf="#{treeNode.leafIcon}">
                       <h:outputText value="#{item}"/>
                   </rich:treeNode>
                   <rich:treeNode type="leaf" dragType="pic">
<rich:dndParam name="label" type="drag">#{item}</rich:dndParam> <h:outputText value="#{item}"/>
                   </rich:treeNode>
               </rich:tree>
               <rich:panel id="selectedNode">
<rich:dataGrid id="selectedNodeGrid" style="display: #{!empty simpleTreeDndBean.selectedNodeChildren ? '' : 'none'}" value="#{simpleTreeDndBean.selectedNodeChildren}" var="item" columns="3" border="0"> <rich:dragSupport dragIndicator="indicator1" dragType="pic" dragValue="#{item}" reRender="selectedNodeGrid"> <rich:dndParam name="draggedImage" value="#{item.data}"/>
                       </rich:dragSupport>
<h:graphicImage value="/WEB-INF/images/#{item.data}" />
                   </rich:dataGrid>
               </rich:panel>
           </h:panelGrid>
</h:form>
   </f:view>
</ui:composition>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Portlet.xml entry:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<portlet>
  <portlet-name>TreePortlet</portlet-name>
  <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
  <init-param>
     <name>javax.portlet.faces.defaultViewId.view</name>
     <value>/tree.xhtml</value>
  </init-param>
  <init-param>
     <name>javax.portlet.faces.preserveActionParams</name>
     <value>true</value>
  </init-param>
  <expiration-cache>0</expiration-cache>
  <supports>
     <mime-type>text/html</mime-type>
     <portlet-mode>VIEW</portlet-mode>
  </supports>
  <portlet-info>
     <title>Simple Richfaces Portlet</title>
  </portlet-info>
</portlet>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

From the faces-config.xml

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<application>
       <view-handler>
           org.jboss.portletbridge.application.PortletViewHandler
       </view-handler>
<state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
   </application>

   <managed-bean>
 <managed-bean-name>simpleTreeDndBean</managed-bean-name>
<managed-bean-class>org.richfaces.demo.tree.SimpleTreeDndBean</managed-bean-class>
 <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

web.xml

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
        version="2.4">

  <description>RichFacesPortlet</description>

  <context-param>
     <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>org.jboss.portletbridge.application.FaceletPortletViewHandler</param-value>
  </context-param>

  <context-param>
     <param-name>javax.portlet.faces.renderPolicy</param-name>
     <param-value>ALWAYS_DELEGATE</param-value>
  </context-param>

  <context-param>
     <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
     <param-value>rfRes</param-value>
  </context-param>

  <context-param>
     <param-name>org.richfaces.LoadStyleStrategy</param-name>
     <param-value>NONE</param-value>
  </context-param>

  <context-param>
     <param-name>org.richfaces.LoadScriptStrategy</param-name>
     <param-value>NONE</param-value>
  </context-param>

  <context-param>
     <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
     <param-value>false</param-value>
  </context-param>

   <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
   </context-param>
  <!-- JSF -->

  <context-param>
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
     <param-value>.xhtml</param-value>
  </context-param>

  <context-param>
     <param-name>facelets.DEVELOPMENT</param-name>
     <param-value>true</param-value>
  </context-param>
<context-param>
       <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
<param-value>true</param-value> </context-param> <filter>
     <display-name>Ajax4jsf Filter</display-name>
     <filter-name>ajax4jsf</filter-name>
     <filter-class>org.ajax4jsf.Filter</filter-class>
  </filter>
  <filter-mapping>
     <filter-name>ajax4jsf</filter-name>
     <servlet-name>FacesServlet</servlet-name>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>REQUEST</dispatcher>
     <dispatcher>INCLUDE</dispatcher>
  </filter-mapping>

  <servlet>
     <servlet-name>FacesServlet</servlet-name>
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
     <servlet-name>FacesServlet</servlet-name>
     <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>

  <session-config>
     <session-timeout>10000000</session-timeout>
  </session-config>

    <servlet>
   <description>MVC Servlet for Jetspeed Portlet Applications</description>
   <display-name>Jetspeed Container</display-name>
   <servlet-name>JetspeedContainer</servlet-name>
<servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
   <init-param>
     <param-name>contextName</param-name>
     <param-value>richfaces-portlet</param-value>
   </init-param>
   <load-on-startup>100</load-on-startup>
  </servlet>

 <servlet-mapping>
   <servlet-name>JetspeedContainer</servlet-name>
   <url-pattern>/container/*</url-pattern>
 </servlet-mapping>

</web-app>

+++++++++++++++++++++++++++++++++++++++++++++++++++++

Yes the session timeout configuration is obscenely high, it was part of a test, the value inserted there seems to have no relation to my problem.

Hoping someone can help,

David Dyer

Youssef Mohammed wrote:
AFAIK , richfaces doesn't(wasn't) work(ing) with myfaces/tomahawk. We are
using 1.2 RI for that.
There is also a known issue in the fileupload component working with the
portletbridge.


On Thu, Sep 18, 2008 at 1:12 AM, David Dyer <[email protected]>wrote:

Before I try them and end up pulling my hair out in frustration, am I
likely to run into the same kind of issues that the tomahawk extension
filter has?

Youssef Mohammed wrote:

we dumped ICEfaces for richfaces that along with portletbridge work just
fine in portals.
The main issue we had then with ICEfaces was the comet/pushlet thing that
1- You have to define new servlet that operate outside our JSF/Facelets
one.

2- doesn't scale well
3- A hell of headache for firewalls that usually closed their longed lived
connections.
Having said that, the richfaces is used under JBoss Portal and we haven't
tried it under Jetspeed yet.

Regards,
      Youssef

On Wed, Sep 17, 2008 at 9:07 PM, Brad Gardner <[email protected]>
wrote:



From what I can tell, its been done.  I however, am currently working on
it
myself and have had some difficulty getting the environment configuration
right.  I've recently developed a portlet for a client using IceFaces
that
they run in Liferay, and from first hand experience can say that it is a
very suitable framework for portlet development.  If I make any headway
on
getting my test portlet into Jetspeed 2 I'll be sure to let you know.

On Wed, Sep 17, 2008 at 9:52 AM, David Dyer <[email protected]


wrote:
     Hi everyone, in my never ending quest to improve my user interface
I've
stumbled accross ICEfaces, a set of AJAX based jsf components. Now I've


done


some web searches about integrating ICEfaces with Jetspeed, but mostly


the


results are old and somewhat ambiguous and I was wondering if, before I


go


too deep down the rabbit hole, anyone had tried this recently.

Possible issues I've been seeing (but again, I'm unsure if these are


"real"


problems still):

Integration into portlet lifecycle / conflicts with standard jsf bridges
jars.
Possible conflicts between ICEfaces themes and portlet decorators.
Problems on pages that incorporate both ICEfaces and jsf portlets in the
same aggregation (unclear if this is more of a problem if they come from


the


same .war or seperate .wars, judging by the possible issue with bridges


I'm


guessing the latter).


Any info about potential problems, links to decent descriptions of


portlet


configs etc... would be useful.

David Dyer


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




--
Brad Gardner




 ------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG. Version: 7.5.524 / Virus Database: 270.6.21/1676 - Release
Date: 17/09/2008 9:33 AM


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG. Version: 7.5.524 / Virus Database: 270.6.21/1676 - Release Date: 17/09/2008 9:33 AM


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to