[jboss-user] [JBoss Seam] - Outjected @DataModelSelection value lagging?

mail.micke@gmail.com do-not-reply at jboss.com
Fri Jun 1 09:31:47 EDT 2007


Hi

Not sure what I'm doing wrong, but the outjected value for a data model selection is lagging for me.
By lagging I mean that if I click one row and then another row, the outjected datamodel selection after the second row click is the object for the first click.

But if I get the value via a getter on the backing bean I get the correct object after the second click.

Anyone have any ideas of what is going on (I'm new to seam ).

Configuration:
myfaces 1.1.5
facelets 1.2
seam 1.2.1.GA
tomcat 5

Managed bean code:


  | 
  | @Name("riskAddonBacking")
  | @Scope( ScopeType.CONVERSATION)
  | public class CountryRiskAddonBacking  implements Serializable{
  | 	
  | 	/**
  | 	 * 
  | 	 */
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	@DataModel
  | 	private List<CountryRiskAddonBean> searchResults;
  | 	
  | 	@DataModelSelection("searchResults")
  | 	@Out(required=false)	
  | 	private CountryRiskAddonBean selectedItem;
  | 	
  | 
  | 	
  | 	private String searchPattern;
  | 	
  | 	@Begin(pageflow="countryaddon")
  | 	public void startPageFlow(){
  | 		
  | 	}
  | 		
  | 	public String performSearch(){
  | 		
  | 		int nbrHits = RandomUtils.nextInt()%10;
  | 		List<CountryRiskAddonBean> tmpList = new ArrayList<CountryRiskAddonBean>(nbrHits);
  | 		for(int i=0; i<nbrHits; i++ ){
  | 			 CountryRiskAddonBean cab = new CountryRiskAddonBean();
  | 			 cab.setTicketNumber("RSK-" + (RandomUtils.nextInt()%10000) );
  | 			 cab.setCptyName("CptyXYZ");
  | 			 cab.setCountryOfRisk("SWE");
  | 			 tmpList.add( cab );
  | 		}
  | 		searchResults = tmpList;
  | 		
  | 		return null;
  | 	}
  | 	
  | 	public String save(){
  | 		System.out.println("SAAAAAAVVVVVVIIIIIIIIINNNNNNNNGGGGGGGG to db");
  | 		
  | 		return "";
  | 	}
  | 
  | 	public String getSearchPattern() {
  | 		return searchPattern;
  | 	}
  | 
  | 	public void setSearchPattern(String searchPattern) {
  | 		this.searchPattern = searchPattern;
  | 	}
  | 
  | 	public CountryRiskAddonBean getSelectedItem() {
  | 		return selectedItem;
  | 	}
  | 
  | 	public void setSelectedItem(CountryRiskAddonBean selectedItem) {
  | 		this.selectedItem = selectedItem;
  | 	}
  | 	
  | }
  | 


xhtml code:


  | <ui:composition  template="/WEB-INF/layout/template.xhtml">
  | 		<ui:param name="title" value="Pageflow Start"/>		
  | 		
  | 	<ui:define name="body">
  | 		<p>
  | 			Conversation id: #{conversation.id}
  | 		</p>
  | 		<p>
  | 			Selected item:<h:outputText value="#{selectedItem.ticketNumber}" rendered="#{not empty selectedItem}"/>
  | 		</p>
  | 		<p>
  | 			Selected item (via getter):<h:outputText value="#{riskAddonBacking.selectedItem.ticketNumber}" rendered="#{not empty riskAddonBacking.selectedItem}"/>
  | 		</p>
  | 		<h:form>
  | 			<s:decorate>			
  | 				<h:inputText id="srchPatt" value="#{riskAddonBacking.searchPattern}" required="true"/>
  | 			</s:decorate>
  | 						
  | 			<s:button  action="#{riskAddonBacking.performSearch}" value="Search"/>			
  | 			
  | 			<h:outputText value="Found #{searchResults.rowCount} hits"
  | 						  rendered="#{searchResults.rowCount > 0}"/>							  		
  | 		</h:form>
  | 		
  | 		
  | 		<h:form rendered="#{not empty searchResults}">	
  | 			<h:dataTable value="#{searchResults}"
  | 							var="_item">
  | 				<h:column>
  | 					<f:facet name="header">
  | 						Ticket Number
  | 					</f:facet>
  | 					#{_item.ticketNumber}
  | 				</h:column>
  | 				<h:column>
  | 					<f:facet name="header">
  | 						Counterparty
  | 					</f:facet>
  | 					#{_item.cptyName}
  | 				</h:column>
  | 				<h:column>
  | 					<f:facet name="header">
  | 						Country of Risk
  | 					</f:facet>
  | 					#{_item.countryOfRisk}
  | 				</h:column>
  | 				<h:column>
  | 					<f:facet name="header">
  | 						Risk Addon
  | 					</f:facet>
  | 					#{_item.riskAddon}
  | 				</h:column>
  | 				<h:column>
  | 					<f:facet name="header">
  | 						Add/Edit
  | 					</f:facet>
  | 					
  | 					<s:link action="edit" value="Edit" rendered="#{_item.riskAddon > 0}" />
  | 					<s:link action="edit" value="Add" rendered="#{_item.riskAddon == 0}"/>						
  | 					|<s:link action="blah" value="Refresh"/>				
  | 				</h:column>
  | 			</h:dataTable>	
  | 		<!--
  | 			<rich:dataTable value="#{searchResults}"
  | 							var="_item">
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						Ticket Number
  | 					</f:facet>
  | 					#{_item.ticketNumber}
  | 				</rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						Counterparty
  | 					</f:facet>
  | 					#{_item.cptyName}
  | 				</rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						Country of Risk
  | 					</f:facet>
  | 					#{_item.countryOfRisk}
  | 				</rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						Risk Addon
  | 					</f:facet>
  | 					#{_item.riskAddon}
  | 				</rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						Add/Edit
  | 					</f:facet>
  | 					
  | 					<s:link action="edit" value="Edit" rendered="#{_item.riskAddon > 0}" />
  | 					<s:link action="edit" value="Add" rendered="#{_item.riskAddon == 0}"/>					
  | 				</rich:column>
  | 			</rich:dataTable>
  | 			 -->
  | 		</h:form>
  | 		
  | 	</ui:define>
  | </ui:composition>
  | 


Cheers, 
Mike

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

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



More information about the jboss-user mailing list