1 Reply Latest reply on Feb 24, 2010 5:02 AM by Ilya Shaikovsky

    Problem while creating wizard with rich:modalPanel

    debashis Malo Newbie

      Hi,

      I'm new to richfaces. I have created a wizard with next and previous button. Sometimes next/previous button are working in the wizard and sometimes not. I mean clicking on the next/previous button the desired page is not coming.

      There are four pages in the wizard. below is the snapshot of some of the files. I've deployed the code in tomcat v6.0. Please help me out.

       

      [addSource_wizard.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

      type="text/css">
      .col1 { vertical-align:top; }
      .col2 { vertical-align:top; width:450px; }
      .wizard { width:400px; }
      .wform td { vertical-align:top; }
      .wfcol1 { text-align: right; white-space:nowrap;}
      .wfcol2 { }
      .wfcol3 { }
      .s1row td { height:30px; }
      .rich-message { color:red;  }

      .navPanel {
      vertical-align: bottom;
          height:23px;
          padding-top: 5px;
      }
      </style>

      <rich:modalPanel id="panel" width="800" height="400">
      <a4j:keepAlive beanName="fileSourceConfigBean" />
          <f:facet name="header">
              <h:panelGroup>
                  <h:outputText value="Add New Source"></h:outputText>
              </h:panelGroup>
          </f:facet>
          <f:facet name="controls">
              <h:panelGroup>
               <a onclick="Richfaces.hideModalPanel('panel');" href="#">Close</a>
              </h:panelGroup>
          </f:facet>    
           <a4j:form id="add_src_page1_form">
            <div style="height: 100%">
         <a4j:include viewId="/includes/wizard/pages/addSource_page1.xhtml" />
         </div>
           </a4j:form>   
      </rich:modalPanel>
      </ui:composition>

       

       

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

      [ addSource_page1.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">


      <div style="position: relative; width: 100%; height: 80%;">
      <fieldset>
        <h:panelGrid columns="4" style="width: 100%;">
         <h:outputLabel value="Source Name" for="srcName" />
         <h:inputText id="srcName" value="#{fileSourceConfigBean.srcName}"
          required="false" />
         <h:outputLabel value="Source Description" for="srcDesc" />
         <h:inputTextarea id="srcDesc" value="#{fileSourceConfigBean.srcDesc}"
          required="false" />
         <h:outputLabel value="Source Type" for="srcTyp" />
         <h:selectOneMenu id="srcTyp" value="#{fileSourceConfigBean.srcTyp}">
          <f:selectItems value="#{lOVList.srcTypList}" />
         </h:selectOneMenu>
         <h:outputLabel value="Desctination Type" for="destTyp" />
         <h:selectOneMenu id="destTyp" value="#{fileSourceConfigBean.destTyp}">
          <f:selectItems value="#{lOVList.destTypList}" />
         </h:selectOneMenu>
         <h:outputLabel value="Destination Table" for="tblName" />
         <h:inputText id="tblName" value="#{fileSourceConfigBean.destTable}"
          required="false" />
        </h:panelGrid>
      </fieldset>
      </div>
      <div class="navPanel" style="width: 100%; height: 20%;">
      <a4j:commandButton
        style="float:right;vertical-align: bottom;" action="next"
        value="Next &gt;&gt;" immediate="true" /> 
      </div>
      </ui:composition>

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

      [ addSource_file_page2.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>
        .top {
            vertical-align: top;
           
        }
        .info {
            height: 202px;
            overflow: auto;
        }
      </style>
      <div style="position: relative; width: 100%; height: 80%;">
        <fieldset>
         <h:panelGrid columns="2" columnClasses="top,top">
          <h:outputLabel value="Upload Source File" for="srcFile" />
          <rich:spacer/>
          <rich:fileUpload width="100%" fileUploadListener="#{fileSourceConfigBean.fileUploadBean.listener}"
           maxFilesQuantity="#{fileSourceConfigBean.fileUploadBean.uploadsAvailable}" id="srcFile"
           immediateUpload="#{fileSourceConfigBean.fileUploadBean.autoUpload}"
           acceptedTypes="#{fileSourceConfigBean.fileUploadBean.acceptedTypes}"
           allowFlash="#{fileSourceConfigBean.fileUploadBean.useFlash}"
           addControlLabel="Browse....">
           <a4j:support event="onuploadcomplete" reRender="info" />
          </rich:fileUpload>
          <h:panelGroup id="info">
           <rich:panel bodyClass="info">
            <f:facet name="header">Uploaded Files</f:facet>
            <h:outputText value="No files currently uploaded"
                               rendered="#{fileSourceConfigBean.fileUploadBean.size==0}" />
                           <rich:dataGrid columns="1" value="#{fileSourceConfigBean.fileUploadBean.files}"
                              var="file" rowKeyVar="row">
                              <rich:panel bodyClass="rich-laguna-panel-no-header">
                                  <h:panelGrid columns="2">
                                      <h:outputText value="File Name:" />
                                      <h:outputText value="#{file.name}" />
                                      <h:outputText value="File Length(bytes):" />
                                      <h:outputText value="#{file.length}" />
                                  </h:panelGrid>
                              </rich:panel>
                          </rich:dataGrid>
           </rich:panel>
           <rich:spacer height="3"/>
                        <br />
                       <a4j:commandButton action="#{fileSourceConfigBean.fileUploadBean.clearUploadData}"
                           reRender="info, srcFile" value="Clear Uploaded Data"
                           rendered="#{fileSourceConfigBean.fileUploadBean.size>0}" />
          </h:panelGroup>
         </h:panelGrid>
        </fieldset>
      </div>
      <div class="navPanel" style="width: 100%; height: 20%;">
         <a4j:commandButton value="&lt;&lt;Previous" style="float:left" action="previous" immediate="true" />    
          <a4j:commandButton value="Next &gt;&gt;" style="float:right" action="next"  immediate="true" />
         </div>
      </ui:composition>

       

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

      [faces-config.xml]

       

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

      <faces-config
          xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
          version="1.2">
        <application>
          <locale-config>
            <default-locale>en</default-locale>
          </locale-config>
      <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
      <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
        </application>
       
        <managed-bean>
         <managed-bean-name>lOVList</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.lov.LOVList</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
        <managed-bean>
         <managed-bean-name>dBSourceConfigBean</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.viewbeans.DBSourceConfigBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
         <managed-bean-name>fileSourceConfigBean</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.viewbeans.FileSourceConfigBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
         <managed-bean-name>fileUploadBean</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.util.FileUploadBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
         <managed-bean-name>projectManagerBean</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.viewbeans.ProjectManagerBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
       
        <managed-bean>
         <managed-bean-name>sourceSystemListBean</managed-bean-name>
         <managed-bean-class>com.cts.mdm.analyzer.beans.viewbeans.SourceSystemListBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>

      <navigation-rule>
         <from-view-id>/includes/wizard/pages/addSource_page1.xhtml</from-view-id>
          <navigation-case>
            <from-outcome>next</from-outcome>
            <to-view-id>/includes/wizard/pages/addSource_file_page2.xhtml</to-view-id>     
          </navigation-case>
      </navigation-rule>
       
      <navigation-rule>
         <from-view-id>/includes/wizard/pages/addSource_file_page2.xhtml</from-view-id>
          <navigation-case>
            <from-outcome>previous</from-outcome>
            <to-view-id>/includes/wizard/pages/addSource_page1.xhtml</to-view-id>      
          </navigation-case>
          <navigation-case>
            <from-outcome>next</from-outcome>
            <to-view-id>/includes/wizard/pages/addSource_file_page3.xhtml</to-view-id>      
          </navigation-case>
      </navigation-rule>

      <navigation-rule>
         <from-view-id>/includes/wizard/pages/addSource_file_page3.xhtml</from-view-id>
          <navigation-case>
            <from-outcome>previous</from-outcome>
            <to-view-id>/includes/wizard/pages/addSource_file_page2.xhtml</to-view-id>    
          </navigation-case>
          <navigation-case>
            <from-outcome>next</from-outcome>
            <to-view-id>/includes/wizard/pages/addSource_file_page4.xhtml</to-view-id>      
          </navigation-case>     
      </navigation-rule>

      <navigation-rule>
         <from-view-id>/login.xhtml</from-view-id>
          <navigation-case>
            <from-action>#{projectManagerBean.viewProjectAction}</from-action>      
            <from-outcome>success</from-outcome>
            <to-view-id>/projectView.xhtml</to-view-id>      
          </navigation-case>    
      </navigation-rule>
       
      <navigation-rule>
         <from-view-id>/projectView.xhtml</from-view-id>
          <navigation-case>
          <from-action>#{sourceSystemListBean.viewSourceAction}</from-action>       
            <from-outcome>success</from-outcome>
            <to-view-id>/sourceView.xhtml</to-view-id>      
          </navigation-case>    
      </navigation-rule>
       
        <navigation-rule>
         <from-view-id>/sourceView.xhtml</from-view-id>
          <navigation-case>           
            <from-outcome>home</from-outcome>
            <to-view-id>/projectView.xhtml</to-view-id>      
          </navigation-case>    
      </navigation-rule> 
          
      </faces-config>

       

      Regards,

      Debashis