2 Replies Latest reply on Apr 1, 2008 3:07 PM by Sirish Vadala

    Problem with Richfaces and JSF RI

    Sirish Vadala Newbie

      Hello everyone,

      I had integrated Richfaces-3.0.0 and ajax4Jsf-1.1.0 with Sun's JSF RI 1.1 for implementing the richfaces tree component. I was pretty much successful in rendering the tree component and when ever I click on the node, the ajax request is getting submitted. The problem arises here: after the ajax request is submitted, it is throwing me a class cast exception during render response phase. Any help would be highly appreciated.

      The error message log for the request is as follows:

      Processing new Request!
      before - RESTORE_VIEW 1
      after - RESTORE_VIEW 1
      before - APPLY_REQUEST_VALUES 2
      INFO : backingbeans.SimpleTreeBean: getTreeNode:Initiated
      INFO : backingbeans.SimpleTreeBean: getTreeNode:Completed
      after - APPLY_REQUEST_VALUES 2
      before - PROCESS_VALIDATIONS 3
      after - PROCESS_VALIDATIONS 3
      before - UPDATE_MODEL_VALUES 4
      INFO : backingbeans.SimpleTreeBean: processSelection:Initiated
      INFO : backingbeans.SimpleTreeBean: processSelection:Completed
      after - UPDATE_MODEL_VALUES 4
      before - INVOKE_APPLICATION 5
      after - INVOKE_APPLICATION 5
      before - RENDER_RESPONSE 6
      <Apr 1, 2008 8:24:17 AM PDT> <Error> <HTTP> <BEA-101020> <[weblogic.servlet.internal.WebAppServletContext@bacf07 - appName: '_appsdir_BillSearch_war', name: 'BillSearch.war', context-path: ''] Servlet failed with Exception
      java.lang.ClassCastException: javax.faces.component.html.HtmlForm
       at com.sun.faces.taglib.jsf_core.VerbatimTag.doAfterBody(VerbatimTag.java:82)
       at jsp_servlet._pages.__billheaderinit._jsp__tag2(__billheaderinit.java:241)
       at jsp_servlet._pages.__billheaderinit._jsp__tag1(__billheaderinit.java:201)
       at jsp_servlet._pages.__billheaderinit._jspService(__billheaderinit.java:139)
       at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
       Truncated. see log file for complete stacktrace
      >


      My JSF page is as follows:

      <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
       <r:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
       reRender="billsearch:billSearchForm:NewTabadvanceSearch:selectedNode" ajaxSubmitSelection="true" switchType="client"
       value="#{simpleTreeBean.treeNode}" var="item">
       </r:tree>
       <h:outputLabel value="Selected Node: #{simpleTreeBean.nodeTitle}" id="selectedNode" />
       </h:panelGrid>


      Appreciate if someone can give a hint on this.
      Thanks.

        • 1. Re: Problem with Richfaces and JSF RI
          Nick Belaevski Master

          Could you please post the complete page? I can see there are some f:verbatim tags by the stack trace attached, but I cannot see any in the page code attached.

          • 2. Re: Problem with Richfaces and JSF RI
            Sirish Vadala Newbie

            Thanks for the response. This is the code for my entire page. I also have some myFaces tomahawk components embedded into the page. Let me know if you need to see any more code snippets for backing beans.

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
            <%@ page language="java" contentType="text/html; charset=UTF-8" %>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
            <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
            <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="r"%>
            
            <f:loadBundle basename="resources.application" var="bundle"/>
            <f:subview id="billsearch">
            <html>
            <body>
            <style type="text/css">
             table.vr {
             border-collapse:collapse;
             border-left:2px solid lightblue;
             border-right:2px solid lightblue
             }
             td.mn {
             border-right:2px solid lightblue
             }
             .col,.col2 {
             width:50%;
             vertical-align:top;
             }
            </style>
            <script language="JavaScript" src="../scripts/lrrscript.js"></script>
            <h:form id="billSearchForm">
             <t:panelTabbedPane
             id="tabPanel" serverSideTabSwitch="false" styleClass="tabbedPane"
             activeTabStyleClass="activeTab" inactiveTabStyleClass="inactiveTab"
             disabledTabStyleClass="disabledTab" activeSubStyleClass="activeSub"
             inactiveSubStyleClass="inactiveSub" tabContentStyleClass="tabContent"
             frame="border" selectedIndex="#{billsearch.tabIndex}">
             <%-- SIMPLE SEARCH TAB --%>
             <t:panelTab id="simpleSearch" label="Search" onkeypress="unsetFlag();" onclick="unsetFlag();">
             <h:inputHidden id="locationtype" value=""/>
            
             <%-- Bill Search Criteria Heading --%>
             <h:panelGrid width="100%" headerClass="sectionHeading" styleClass="sectionBorder" onkeypress="unsetFlag();" onclick="unsetFlag();">
             <f:facet name="header">
             <h:panelGroup>
             <h:outputText value="#{bundle['billSearch.title']}"/>
             </h:panelGroup>
             </f:facet>
            
            
             </h:panelGrid>
             </t:panelTab>
            <%-- ADVANCE SEARCH TAB --%>
             <t:panelTab id="advanceSearch" label="Text Search" onkeypress="setFlag();" onclick="setFlag();">
            
             <h:panelGrid width="100%" headerClass="sectionHeading" styleClass="sectionBorder" onkeypress="setFlag();" onclick="setFlag();">
            
             <%-- Bill Search Criteria Heading --%>
             <f:facet name="header">
             <h:panelGroup>
             <h:outputText value="#{bundle['billSearch.title']}"/>
             </h:panelGroup>
             </f:facet>
            
             <%-- Panel grid for for entering the search criteria based on words or phrases --%>
            
             </h:panelGrid>
             </t:panelTab>
            
            
             <t:panelTab id="NewTabadvanceSearch" label="Advance Search">
            
             <f:facet name="header">
             <h:panelGroup>
             <h:outputText value="#{bundle['billSearch.title']}"/>
             </h:panelGroup>
             </f:facet>
            
            
             <!-- MYFACES TOMAHAWK Expand/Collapse Handled By Server -->
             <t:tree2 id="serverTree" value="#{treeBean.treeStructure}" var="node" preserveToggle="false" varNodeToggler="t" clientSideToggle="false">
             <f:facet name="person">
             <h:panelGroup>
             <t:graphicImage value="/images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage value="/images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
             </h:panelGroup>
             </f:facet>
             <f:facet name="foo-folder">
             <h:panelGroup>
             <t:graphicImage value="/images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage value="/images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
             <h:outputText value=" (#{node.childCount})" styleClass="childCount" rendered="#{!empty node.children}"/>
             </h:panelGroup>
             </f:facet>
             <f:facet name="bar-folder">
             <h:panelGroup>
             <t:graphicImage value="/images/blue-folder-open.gif" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage value="/images/blue-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
             <h:outputText value=" (#{node.childCount})" styleClass="childCount" rendered="#{!empty node.children}"/>
             </h:panelGroup>
             </f:facet>
             <f:facet name="document">
             <h:panelGroup>
             <h:commandLink immediate="true" styleClass="#{t.nodeSelected ? 'documentSelected':'document'}" actionListener="#{t.setNodeSelected}">
             <t:graphicImage value="/images/document.png" border="0"/>
             <h:outputText value="#{node.description}"/>
             <f:param name="docNum" value="#{node.identifier}"/>
             </h:commandLink>
             </h:panelGroup>
             </f:facet>
             </t:tree2>
            
             <%-- TOMAHAWK Normal Tree Component --%>
            
             <t:tree id="tree" value="#{treeBean.tree1}" styleClass="nodeFolder" nodeClass="nodeFolder" selectedNodeClass="childCount" expandRoot="true">
             </t:tree>
            
            
             <%-- RICHFACES Normal Tree Component --%>
             <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
             <r:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
             reRender="selectedNode" ajaxSubmitSelection="true" switchType="client"
             value="#{simpleTreeBean.treeNode}" var="item">
             </r:tree>
             <h:outputLabel value="Selected Node: #{simpleTreeBean.nodeTitle}" id="selectedNode" />
             </h:panelGrid>
            
             <%-- TOMAHAWK tree action --%>
             <h:panelGroup>
             <h:panelGrid width="100%" style="text-align: center">
             <h:panelGroup>
             <h:commandButton id="advSearch" value="Expand Node" actionListener="#{treeBean.expandPath}" styleClass="buttons"/>
             <h:outputText value=" "/>
             <h:commandButton value="#{bundle.clear}" styleClass="buttons"/>
             </h:panelGroup>
             </h:panelGrid>
             </h:panelGroup>
             </t:panelTab>
            
             </t:panelTabbedPane>
            </h:form>
            
            <h:form id="hidden" target="popup">
             <h:inputHidden id="locationtype" value="#{billsearch.popupLocationsFor}"/>
             <h:inputHidden id="sessionyr" value="#{billsearch.session_year}"/>
             <h:commandLink id="go" action="#{billsearch.showLocations}"/>
            </h:form>
            
            </body>
            </html>
            </f:subview>