2 Replies Latest reply on Jun 27, 2007 8:40 AM by thatrichard

    CommandLink in DataTable:  Session vs Conversation scope

      Here is a bean and jsf form that implement a simple search. The emboldened commandLink ought to be invoking the bean's "select" method, which it does.

      However, this only works when I include the emboldened Scope annotation. Without it, the scope will be Conversation and the conversation will be promoted to a long-running conversation by the "find" method.

      I'm stumped as to why this won't work in conversation mode. More perplexingly (or perhaps reveallingly) the commandButton at the bottom of the form works even though it has the same action. The only difference that I can see is that it is outside of the dataTable.

      I have come posts such as this one:
      http://forum.java.sun.com/thread.jspa?threadID=549675&start=0 , which suggests that others have encountered this behaviour.

      Clearly there is something about conversations that I don't understand.

      Can anyone help?

      Thanks

      Richard

      @Name("partyFinder")
      @Stateful
      @Scope(ScopeType.SESSION)
      public class PartyFinderBean implements PartyFinder {
      
       @DataModel
       private List<Party> matchingParties;
      
       @DataModelSelection
       private Party selectedParty;
      
       @In
       private Session session;
      
       @Begin(flushMode=FlushModeType.MANUAL, join=true)
       public String find() {
       Party example = new Person();
       //do the search
       matchingParties = ...
       return null;
      
       }
      
       public String select() {
       log.info("SELECT INVOKED");
       return "/forms/party/person/identity";
       }
      
       @Remove @Destroy
       public void destroy() { }
      
      }
      
      


       <h:form>
       <h:dataTable value="#{matchingParties}" var="selectedParty">
       <h:column>
       <f:facet name="header">
       <h:outputText value="Last Name"/>
       </f:facet>
       <h:commandLink value="#{selectedParty.lastName}" action="#{partyFinder.select}"/>
       </h:column>
       </h:dataTable>
       <div class="action-bar">
       <h:commandButton id="newperson" value="Create New Person" action="#{personEditor.enterIdentity}" />
       <h:commandButton id="test" value="Test Select" action="#{partyFinder.select}" />
       </div>
       </h:form>
      
      [/url]