2 Replies Latest reply on Sep 12, 2011 12:19 PM by tranaweera

    Seam conversation issue on multiple browser tabs.

    tranaweera
      There is a rich data table to display the search results. Each result row contains s:link to navigate to the edit page. Results will be opened in a new tab when user right click and opened the link. User is allowed to open several tabs and edit data in those tabs. When saving the changes applied to one of the open tab, changes are applied to the last open record but not to the selected record. Please advice me how to solve above mention issue

      Implementation is done as following

      <rich:dataTable>
      <rich:column sortBy="#{salesRentalsDataResult.address}" width="400">
                  <f:facet name="header">
                     <h:outputText value="Address" />
                  </f:facet>
                  <s:link value="#{salesRentalsDataResult.address}" propagation="join"
                     action="#{searchSalesRentalData.selectSalesDataRecord}" view="/page/data/edit-sales.xhtml">
               </rich:column>`
      </rich:dataTable>


      Backing search action implementation as follows

      @Name("searchSalesRentalData")
      @Scope(ScopeType.CONVERSATION)
      public class SearchSalesRentalDataAction implements Serializable {
         @DataModel
         private List<ExchangedListingSummaryDto> exchangedListingSummaryDataModel;

         @Out(required = false)
         @DataModelSelection
         private ExchangedListingSummaryDto exchangedListingSummaryDto;

         @Create()
         @Begin(join = true)
         public void init() {
         //Use to initialize the search parameters
         }

          **
          * Empty method to support datamodel selection.
          */
         public void selectSalesDataRecord() {
            this.log.info("The ExchangedListingSummaryDto which has the id [#0] is selected.",
                          this.exchangedListingSummaryDto.getId());
         }
      }

      @Name("editSalesData")
      @Scope(ScopeType.CONVERSATION)
      public class EditSalesDataAction extends BaseListingUpdateAction implements Serializable {
         @In(required = false)
         private SoldListingSummaryDto exchangedListingSummaryDto;

         private void update() {

         }

      }


        • 1. Re: Seam conversation issue on multiple browser tabs.
          kragoth

          Well, the problem is a simple case of programming logic.


          Basically you have one variable x. Each time someone clicks on a link you are setting x to a value based on what they clicked on. So x is always equal to the last click they made.


          You have only 1 conversation going on. Thus there is only one instance of your variable.


          So either you need to start a new conversation with each click (instead of joining like you are now) or you need to use a request param or something to identify which x you are editing. (Your EL expressions would bind to an indexed array essentially. I don't remember the exact syntax but something like... #{MyBean.arrayOfXs[myRequestParam].field1})

          • 2. Re: Seam conversation issue on multiple browser tabs.
            tranaweera

            I have change the above implementation and change the implementation according to the following example. Red hat example . Now selected results do not load to the edit page.


            Please let me know the changes need to the above code. If there is a complete seam data model selection example please let me know the URL.