[jboss-user] [JBoss Seam] - Datmodel(Selection with facelets) does not work

baz do-not-reply at jboss.com
Tue Aug 28 07:53:19 EDT 2007


Hello,
today i have a question about DataModelSelection. I have not found an answer for this for more than one year. But now a solution will be greatly appreciated.
This is the starting point: (all code is simplified)
i do have a fully functinal page in my app:

  | [...]
  | 			<rich:dataTable id="experimentSiteList" var="experimentSite"	value="#{experimentSiteList}">
  | 				
  | 				<rich:column>
  | 					<h:outputText size="5" id="year" value="#{experimentSite.experiment.year}"></h:outputText>
  | 				</rich:column>
  | [...]
  | 				<rich:column>
  | 					<s:link id="viewFieldplan" value="Fieldplan"
  | 						action="#{htmlFieldplanBacking.showFieldplan}"
  | 						propagation="begin" target="Fieldplan">
  | 						<f:param name="experimentid"
  | 							value="#{experimentSite.experiment.experimentId}" />
  | 					</s:link>
  | 				</rich:column>
  | 			</rich:dataTable>
  | 
and the backing contains the datamodel 
	@DataModel
  | 	private List<ExperimentSite> experimentSiteList;
  | 
  | 	@DataModelSelection
  | 	@Out(required=false)
  | 	private ExperimentSite selectedExperimentSite;
  | 
  | 	@Factory("experimentSiteList")
  | 	public void getExperimentSitesByUser() {
  | 		experimentSiteList = experimentQuery.getResultList();
  | 	}	
  | 
  | 
The experimentSites are shown and when clicking on the link the selectedExperimentSite is set.

The problem is:
We do need more than one of this kind of page, but with different kind of actions.

So the not working solution would be to use facelets:
[This refactored xhtml page does not work]

  | <ui:component>
  | 			<rich:dataTable id="experimentSiteList" var="experimentSite"	value="#{list}">
  | 				
  | 				<rich:column>
  | 					<h:outputText size="5" id="year" value="#{list}"></h:outputText>
  | 				</rich:column>
  | [...]
  | 				<rich:column>
  |                                                     <ui:insert name="actions"/>
  | 				</rich:column>
  | 			</rich:dataTable>
  | </ui:component>
  | 
The calling page:

  | [....]
  | <ui:decorate template="myTemplate.xhtml">
  |       <ui:param name="list" value="experimentSiteList"/>
  |       <ui:define name="actions">
  | 					<s:link id="viewFieldplan" value="Fieldplan"
  | 						action="#{htmlFieldplanBacking.showFieldplan}"
  | 						propagation="begin" target="Fieldplan">
  | 						<f:param name="experimentid"
  | 							value="#{experimentSite.experiment.experimentId}" />
  | 					</s:link>
  |       </ui:define>
  | </ui:decorate>
  | [....]
  | 
The List of ExperimentSites are rendered as expected. But when clicking on a link the DataModelSelection selectedExperimentSite is null. Why?
Any insight is greatly welcomed.

Or, if you have a working solution, please share it with us. Thanks.
Ciao,
Carsten

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

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



More information about the jboss-user mailing list