[jboss-user] [JBoss Seam] - Re: @Factory and @DataModel on the same method

fabricio.lemos do-not-reply at jboss.com
Fri Mar 16 14:38:47 EDT 2007


"fabricio.lemos" wrote : "petemuir" wrote : This is bad idea.  How is Seam to know whether you want a DataModel or a List when you access the useCaseList context variable?
  | 
  | It really makes sense. Thank you.

I was looking on others datamodels that I have and got I little more confusing. I found this method:


  | 	@DataModel
  | 	public List<Step> getStepList(){
  | 		return useCase.getSteps();
  | 	}
  | 

And the dataTable that reads the DataModel:


  | <h:dataTable value="#{stepList}" var="stepVar">
  | 	<h:column>
  | 		<f:facet name="header">Name</f:facet>
  | 	     #{stepVar.name}
  | 	</h:column>
  | 	<h:column>
  | 		<f:facet name="header">Edit</f:facet>
  | 		<h:commandLink value="Edit" action="updateStep" />
  | 	</h:column>
  | </h:dataTable>
  | 

I do not know how Seam knows if it is a DataModel or a List when stepList is accessed, but it works pretty fine, also injecting the selected entity through a @DataModelSelection annotation.

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

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



More information about the jboss-user mailing list