1 Reply Latest reply on Dec 1, 2009 3:56 PM by hubaer

    rich:dataTable and back button

      Hello all,


      I have a little problem with the back button in Seam. We have an overview page, in which you can select an entry to get to a detail page.
      Say, we have 2 entries in our overview page. I select the first one, I get redirected tothe detail page. After going back with the browser back button and select the same entry again, all is ok.
      If I select another entry, a null value is passed into the method showMember (see below).


      Here some code fragments, hoping someone can help me in this issue:


      ActionBean defining the DataModel


      @Name("SearchAction")
      @Scope(ScopeType.SESSION)
      public class SearchActionBean implements Serializable {
      
       ...
      
          @In(create=true)
          private FacesMessages facesMessages;
      
          @DataModel
          private List<Invoice> invoices = null;
      
          public void find() {
              // queryInvoices
          }
      
       ...
      




      ActionBean for the detail information


      @Name("showActionBean")
      @Scope(ScopeType.SESSION)
      public class ShowActionBean implements Serializable {
      
      ...
          @In()
          @Out(required=false)
          private Member member;
      
        public void showMember(Member member) {
              this.member = member;
          }
       ...
      
      




      Fagment from the .xhtml


      ...
      <rich:dataTable id="invoiceList"
                      columnClasses="col"
                      value="#{invoices}"
                      var="inv" >
           <rich:column width="55" sortBy="#{inv.documentNumber}">
                 <f:facet name="header">
                    <h:outputText styleClass="headerText" value="#{messages['documentNo']}" />
                 </f:facet>
                 #{inv.documentNumber}
           </rich:column>
           <rich:column width="50" sortBy="#{inv.documentDate}">
                 <f:facet name="header">
                    <h:outputText styleClass="headerText" value="#{messages['documentDate']}" />
                 </f:facet>
                 <h:outputText value="#{inv.documentDate}"><f:convertDateTime pattern="#{commonDataHelper.datePattern}" type="date" /></h:outputText>
            </rich:column>
                                      
            <rich:column width="50" sortBy="#{inv.member.username}">
                 <f:facet name="header">#{messages['username']}</f:facet>
                 <s:link action="#{showAction.showMember(inv.member)}" styleClass="noDecoration">#{inv.member.username}</s:link>
            </rich:column>
      ...                            
      



      pages.xml


      ....
      <page view-id="/invoice/invoiceSearch.xhtml">
              
          <navigation from-action="#{showAction.showMember(inv.member)}">
              <redirect view-id="/protected/memberDetail.xhtml"/>
          </navigation>
      
      </page>
      ...
      



      I tried the @DataModelSection, and get the selected entry direct from the search action instead of the var from the rich:dataTable.


      I don't know if this is a problem with Seam and RichFaces !?!


      Our environment:



      • Seam 2.2.0.GA

      • RichFaces 3.2.2.SR1

      • Trinidad 1.2.12



      Hoping someone could point me on what I'm missing.


      Regards
      Marco

        • 1. Re: rich:dataTable and back button

          Hello all,


          I finally found the problem in my application, so I reply to my own posting.


          The problem was that in the ShowActionBean contains also a @DataModel on an getter with the same name as the data model in the SearchActonBean:


          ActionBean for the detail information


          @Name("showActionBean")
          @Scope(ScopeType.SESSION)
          public class ShowActionBean implements Serializable {
          
          ...
              @In()
              @Out(required=false)
              private Member member;
          
            public void showMember(Member member) {
                  this.member = member;
              }
          
          
              @DataModel
              public List<Invoice> getInvoices() {
                  return documents;
              }
           ...
          



          So I have two data models with the same name in the same scope.


          After changing the name of the getInvoices-data model all works as excepted.


          Regards


          Marco