This content has been marked as final.
Show 3 replies
-
1. Re: Problem with Two DataModel
m.shinde Aug 29, 2007 10:09 AM (in response to keuller)First thing don't use Datamodel name and List name same.
Second define DataModelSelection for Servico.
Basically DataMOdelSelection used for Clickable Datatable.LIke if you have EDIT/DEL functionality on h:datatable. -
2. Re: Problem with Two DataModel
lucasdeoliveira Aug 29, 2007 10:15 AM (in response to keuller)Hi!
I'm using Jboss Seam, so I'm not sure if it will be as helpfull as u like but I would cut off these Datamodel names. So in resume, try the code below:@Name("servicoBean") @Scope(ScopeType.EVENT) public class ServicoBean { @Logger private Log log; @DataModel private List<Categoria> categorias; @DataModelSelection("categorias") private Categoria categoria; @DataModel private List<Servico> servicos; ... }
I've done that with JSF+Seam and it works like a charm.
cheers!
ps.: If that doesn't help it would be good to post the stack trace so we can take a look at it and see if it's something else. -
3. Re: Problem with Two DataModel
keuller Aug 29, 2007 10:32 AM (in response to keuller)Thanks for all tips, but anyone works.
Below is my modified code:@Name("servicoBean") @Scope(ScopeType.EVENT) public class ServicoBean { @Logger private Log log; @DataModel private List<Categoria> categorias; @DataModelSelection("categorias") private Categoria categoria; @DataModel private List<Servico> servicos; @DataModelSelection("servicos") private Servico servico; ... }
I dont change anyXHTML code of "servicos.xhtml" page. The first @DataModel "categoria" works fine and display all data, but second "servicos" does not works again. I use two XHTML pages, the first page called "servicos.xhtml" shows result of "categorias" DataModel object and second page "listServices.xhtml" shows the result of "servicos" DataModel object, but any data is displayed on "listServices.xhtml".
The action code fired by <t:commandLink /> inside <t:dataTable />:.. public String selecionaCategoria(Categoria categ) { log.info("Selecionando a categoria..." + categ.getId()); this.categoria = categ; findServicos(); return "success"; } ...
I'm using JBoss EL to call this action method. Here is code of "listServices.xhtml" page:... <h:form id="frmServicos"> <t:dataList var="servico" value="#{servicos}" layout="simple" preserveDataModel="false"> <h:outputText value="#{servico.titulo}" /> </t:dataList> </h:form> ...
This <t:dataTable /> is empty but there is data in DataModel collection. I have two @Factory objects for each @DataModel object.
Any suggestion ?
Regards.