1 Reply Latest reply on Aug 6, 2012 2:48 PM by srinivas nandula

    Richfaces 4 with webflow 2.3

    srinivas nandula Newbie

      Hi I am having an issue with Richfaces 4 and webflow 2.3

       

      I have a page with some search fields and a button. On entering the search criteria, i want to display a rich:datatable in the same page. I configured richfaces to work with webflow properly.

       

      On the first request, the page shows up properly. I enter my search criteria and defined the flow. Since i have to show the results in the same page, i provided the transition on without the transition to.. hoping to see the results in the same page. But i get an exception as below.

       

      org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'caregiverLookup' of flow 'main'

          at org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:571)

          at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:262)

          at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)

          at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)

          at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)

          Truncated. see log file for complete stacktrace

      java.lang.NullPointerException

          at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:1298)

          at javax.faces.component.UIComponentBase.getClientId(UIComponentBase.java:935)

          at javax.faces.component.UIComponent.getContainerClientId(UIComponent.java:436)

          at javax.faces.component.UIForm.getContainerClientId(UIForm.java:461)

          at javax.faces.component.UIComponentBase.getClientId(UIComponentBase.java:918)

       

      I tried to debug the issue and these are my findings..

       

      The first time, it creates a new flow and hence there is no flow execution key. it gets created.

      On my second request after i submit my search options, the flow execution key is forwarded, and instead of creating a new flow, it resumes the flow. This is when i get the exception. I am getting the exception because there is the renderKit in the FacesContext returns null. Ideally it should have the HtmlRenderKit or something like that, but the context has null and therefore the null pointer exception.

       

      To test, i created my search page and the results in seperate pages and provided the transition accordingly.. This works. I see my results in a seperate page. That tells me that my rich faces integration configuration is correct. Why am i not able to show the data in the same page?

       

       

      This is my page.

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

       

      <html 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"

          xmlns:sf="http://www.springframework.org/tags/faces">

       

      <ui:composition template="../../../templates/layout.xhtml">

          <ui:define name="title">

              <h:outputText value="#{msg.home_page_title}"/>

          </ui:define>

          <ui:define name="content">

                 <rich:panel header="Search Hotels" toggleable="true" toggleSpeed="100">

                  <h:form id="form1">

                  <h:panelGrid border="1" style="width:95%;MARGIN-left:20px;">

                      <h:panelGrid columns="5"   style="width:60%;MARGIN-left:10px;TEXT-ALIGN:center;">

                      

                          <h:outputText id="id1" style="TEXT-ALIGN:right;" value="#{msg.search_label}"/>

                          <h:selectOneRadio id="id2"  style=" TEXT-ALIGN: left;;"

                              value="#{personSearchBean.searchType}" layout="pageDirection">

                              <f:selectItem id="id21"  itemLabel="#{msg.veteran_label}" itemValue="11" />

                              <f:selectItem id="id22" itemLabel="#{msg.caregiver_label}" itemValue="2" />

                              <f:selectItem id="id23" itemLabel="Both" itemValue="3" />

                          </h:selectOneRadio>

                         

                          <h:column id="id3">

                          <h:outputText id="id31" style="TEXT-ALIGN:right;" value="#{msg.ssn_label}"/>

                          <h:inputText id="id32" value="#{personSearchBean.ssnNumber}"  style=" TEXT-ALIGN: left;"/>

                          </h:column>

                          <h:column id="id4">

                          <a4j:commandButton id="id41" value="Search" action="searchPerson" render="form2" >

                             

                          </a4j:commandButton>

                          <!-- <h:commandButton id="id41" value="Search" action="searchPerson" /> -->

                         

                           </h:column>

                      </h:panelGrid>

              </h:panelGrid>

              </h:form>

              </rich:panel>

               <div class="dataTable-wrapper">

                <rich:panel header="Search Hotels" toggleable="true" toggleSpeed="100">

                <h:form id="form2">

                    <rich:dataTable id="id5" value="#{veteranList}"       

                      var="veteran"

                      rows="0"  

                      noDataLabel="No record found." 

                      style="width:100%;" >

                      <f:facet name="header" >

                          <rich:columnGroup >

                              <rich:column breakRowBefore="true" rowspan="2" colspan="2">

                                  <h:outputText value="#{msg.vet_ssn}" />

                              </rich:column>

                              <rich:column rowspan="3">

                                  <h:outputText value="#{msg.vet_fName}" />

                              </rich:column>

                              <rich:column rowspan="3">

                                  <h:outputText value="#{msg.vet_mName}"/>

                              </rich:column>

                              <rich:column rowspan="3">

                                  <h:outputText value="#{msg.vet_lName}" />

                              </rich:column>

                              <rich:column rowspan="2">

                                  <h:outputText value="#{msg.vet_dob}" />

                              </rich:column>

                              <rich:column rowspan="2" >

                                  <h:outputText value="#{msg.vet_actions}"/>

                              </rich:column>

                          </rich:columnGroup>

                      </f:facet>

       

                      <rich:column colspan="2">

                          <h:outputText value="#{veteran.vetSSNNumber}"></h:outputText>

                      </rich:column>

                      <rich:column>

                          <h:outputText value="#{veteran.vetFirstName}"></h:outputText>

                      </rich:column>

                      <rich:column>

                          <h:outputText value="#{veteran.vetMiddleName}"></h:outputText>

                      </rich:column>

                      <rich:column>

                          <h:outputText value="#{veteran.vetLastName}"></h:outputText>

                      </rich:column>

                      <rich:column>

                          <h:outputText value="#{veteran.vetDOB}"></h:outputText>

                      </rich:column>

                      <rich:column>

                          <h:commandButton value="Add Caregiver"  action="addCaregiver">

                                <f:param  name="selectedVeteranSSN" value="#{veteran.vetSSNNumber}"/>

                          </h:commandButton>

                      </rich:column>

                     

                     

                          <rich:collapsibleSubTable var="caregiver"

                              value="#{veteran.caregiverList}"  expanded="true">

                              <f:facet name="header">

       

                                  <rich:columnGroup>

                                      <rich:column rowspan="#{veteran.caregiverListSize}">

                                      </rich:column>

       

                                  </rich:columnGroup>

       

                                  <rich:columnGroup>

       

                                      <rich:column breakRowBefore="true" rowspan="2">

                                          <h:outputText value=" #{msg.cg_ssn}" />

                                      </rich:column>

                                      <rich:column rowspan="2">

                                          <h:outputText value="#{msg.cg_fName}" />

                                      </rich:column>

                                      <rich:column rowspan="2">

                                          <h:outputText value="#{msg.cg_mName}" />

                                      </rich:column>

                                      <rich:column rowspan="2">

                                          <h:outputText value="#{msg.cg_lName}" />

                                      </rich:column>

                                      <rich:column rowspan="2">

                                          <h:outputText value="#{msg.cg_dob}" />

                                      </rich:column>

       

                                      <rich:column rowspan="2">

                                          <h:outputText value="#{msg.cg_actions}" />

                                      </rich:column>

                                  </rich:columnGroup>

                              </f:facet>

                              <rich:column>

                              </rich:column>

                              <rich:column breakRowBefore="true">

                                  <h:outputText value="#{caregiver.ssn}"></h:outputText>

                              </rich:column>

       

                              <rich:column>

                                  <h:outputText value="#{caregiver.firstName}">

                                  </h:outputText>

       

                              </rich:column>

                              <rich:column>

                                  <h:outputText value="#{caregiver.middleName}">

                                  </h:outputText>

       

                              </rich:column>

                              <rich:column>

                                  <h:outputText value="#{caregiver.lastName}">

                                  </h:outputText>

       

                              </rich:column>

       

                              <rich:column>

                                  <h:outputText value="#{caregiver.dob}">

                                  </h:outputText>

       

                              </rich:column>

       

                              <rich:column>

                                  <h:commandButton value="Edit"

                                      action="editCaregiver">

                                         <f:param name="selectedVeteranSSN" value="#{veteran.vetSSNNumber}"></f:param>

                                        <f:param name="selectedCaregiverSSN" value="#{caregiver.ssn}"></f:param>

                                  </h:commandButton>

                              </rich:column>

       

                          </rich:collapsibleSubTable>

                  </rich:dataTable>

               </h:form>

               </rich:panel>

                  </div>

                 

               

              <!-- </f:view> -->

          </ui:define>

      </ui:composition>

      </html>

       

       

      And this is my flow

       

      <?xml version="1.0" encoding="UTF-8"?>

      <flow xmlns="http://www.springframework.org/schema/webflow"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

         

          <var name="personSearchBean" class="gov.va.vba.ui.beans.PersonSearchBean" />   

          <view-state id="caregiverLookup">

               <transition on="searchPerson" >

                   <evaluate expression="personSearchBean.getVeterans(caregiverService)"

                  result="viewScope.veteranList" />

              </transition>              

      </flow>

       

       

      I am stuck and not sure how i can proceed.