@DataModel does not create a component
laksu Apr 1, 2007 5:03 PMHi,
I have a SFSB:
/*
package datassist.gop.action;
import datassist.gop.domain.Istek;
import datassist.gop.domain.Uzman;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
import org.jboss.seam.log.Log;
@Stateful
@Name("isteklerAction")
@Scope(ScopeType.SESSION)
public class IsteklerAction implements Serializable, IsteklerActionLocal {
@PersistenceContext(type=PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public IsteklerAction() {
}
@Create
public void init(){
System.out.println("initing istekler. logger is "+((logger==null)?"null":"not null"));
refresh();
}
@DataModel
private List<Istek> isteklerList;
public void refreshIstekler(){
System.out.println("refreshing istekler");
isteklerList=entityManager.createQuery("from Istek i").getResultList();
for(Istek i:isteklerList){
System.out.println("Istek: id="+i.getId()+" konu="+i.getKonu()+" acan="+i.getAcan().getAdSoyad());
}
}
private List<Uzman> uzmanlar;
private void refreshUzmanlar(){
System.out.println("refreshing kullanicilar");
uzmanlar=entityManager.createQuery("from Uzman u").getResultList();
for(Uzman u:uzmanlar){
System.out.println("Uzman: id="+u.getId()+" ad="+u.getAd());
}
}
public void refresh() {
refreshIstekler();
refreshUzmanlar();
}
@DataModelSelection()
private Istek istek;
@Begin
public void setIstek(Istek istek){
System.out.println("Istek=");
System.out.println("Istek: id="+istek.getId());
System.out.println(" konu="+istek.getKonu());
System.out.println(" acan="+istek.getAcan().getAdSoyad());
this.istek=istek;
entityManager.refresh(istek);
}
@Begin
public void select(){
System.out.println("Istek=");
System.out.println("Istek: id="+istek.getId());
System.out.println(" konu="+istek.getKonu());
System.out.println(" acan="+istek.getAcan().getAdSoyad());
}
@End
public void clear() {
istek=null;
}
public List<Istek> getIsteklerList() {
return isteklerList;
}
public void setIsteklerList(List<Istek> istekler) {
this.isteklerList = istekler;
}
public List<Uzman> getUzmanlar() {
return uzmanlar;
}
public void setUzmanlar(List<Uzman> uzmanlar) {
this.uzmanlar = uzmanlar;
}
public void logSomething(){
System.out.println("Trying to log something dummy and the logger is "+((logger==null)?"null":"not null"));
}
@Logger
private Log logger;
@Remove @Destroy
public void destroy(){}
}
and I have the following in my page:
<h:dataTable var="istek" value="#{isteklerlist}">
<h:column>
<f:facet name="header">No</f:facet>
<s:link value="#{istek.id}" action="#{isteklerAction.setIstek(istek)}"/>
</h:column>
<h:column>
<f:facet name="header">Tarih</f:facet>
#{istek.acilis}
</h:column>
<h:column>
<f:facet name="header">Konu</f:facet>
#{istek.konu}
</h:column>
</h:dataTable>
I cannot make the table to display the isteklerList. The table's header shows up but no data. I have verified to print that the data exists. I have a similar page in another app working but this one does not. In fact the DataModel component is not even created. I checked with the debug page to see that no component named "isteklerList" exists.
What am I missing?