[jboss-user] [JBoss Seam] - CommandLink in DataTable: Session vs Conversation scope

thatrichard do-not-reply at jboss.com
Wed Jun 27 06:55:20 EDT 2007


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]

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058077#4058077

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058077



More information about the jboss-user mailing list