1 Reply Latest reply on Dec 7, 2005 7:57 AM by blacky

    DataModel and No conversation context active

    blacky

      Hi everyone!

      I have two pages, displaying data in tables. Tables are in relation 1:n. First page displays data from the master table. Every row contains button, which allows to navigate to detail view, displaying ale data from second table, that are in relation with chosen element.
      First page (master.jsp):

      ...
      <h:dataTable id="workers" value="#{workers}" var="w" >
      ...
       <h:column>
       <h:commandButton id="detailActionID"
       action="#{viewer.showDetail}"
       value="Show detail" />
       </h:column>
      </h:dataTable>
      

      Second page (detail.jsp):
      <h:dataTable id="wards" value="#{wards}" var="ward">
      ...
      </h:dataTable>
      


      ViewerAction stateful bean serves viewing.

      
      @Stateful
      @Name("viewer")
      @Interceptor(SeamInterceptor.class)
      @Conversational(ifNotBegunOutcome="main")
      @Intercept(InterceptionType.ALWAYS)
      public class ViewerAction implements Viewer
      {
       @DataModel
       private List<Worker> workers;
      
       @EJB
       Manage manager;
      
       @Out(value = "wards", required = false)
       private List<Ward> wards;
      
       @DataModelSelection
       private Worker supervisor;
      
       @Begin
       public String watchWorkers()
       {
       this.workers = (List<Worker>) manager.getWorkers();
       return "watchWorkers";
       }
      
       @End
       public String showWardsOfSupervisor()
       {
       this.wards = (List<Wards>)this.manager
       .getAnimalsForSupervisor(supervisor);
      
       return "showWards";
       }
      }
      


      Manager is backing stateful bean, processing bussiness logic.
      I have following flow:
      * [outer] -> ViewerAction.watchWorkers : begin conversation, retrieve data from manage backing bean, displays master table
      * master.jsp -> ViewerAction.showWardsOfSupervisor -> detail.jsp: retrieve detail data from backing bean, displays detail table, end conversation

      All data displays fine. Let's suppose that user press the back button in the browser. Content of the master.jsp generated page displays. Now, user presses the same 'detail' button that he pressed before. The next thing he sees is an empty table only with column headers. I checked - ViewerAction.showWardsOfSupervisor doesn't recieve any input. Why seam doesn't redirect user to main page as specified in @Conversational(ifNotBegunOutcome="main")?

      best regards

        • 1. Re: DataModel and No conversation context active
          blacky

          I made mistake typing action name. It should of course be showWardsOfSupervisor.
          I thought maybe strange behaviour comes from usinjg @Out instead of @DataModel? But I cannot use two @DataModel annotations in one Action class, can I? An conversation cannot span across two different, separated Action classes, am I right?