1.estou usando um rich:dataTable da seguinte forma:
<rich:dataTable id=“produtos” border=“1” value="#{produtoBean.listaIndex}" binding="#{produtoBean.objDataTableProduto}"
-
No qual tenho o metodo listaIndex na Bean: public List><Produto> listaIndex(){ Session session = HibernateUtil.getSession(); Query q = session.createQuery(“from Produto”); List<Produto> produtos = q.list(); return produtos; }
-
Como mudo isso p um rich:dataGrid?
No exemplo do exadel ele mostra:
<rich:dataGrid value="#{dataTableScrollerBean.allCars}" var=“car”>
4.O q é o “dataTableScrollerBean”?
Seria meu produtoBean…
5.E o allCar seria meu “listaIndex” ?
- O exadel manda criar no java o seguinte:
import org.richfaces.component.html.HtmlDataGrid;
…
HtmlDataGrid myList = new HtmlDataGrid();
Fiz dessa forma e não funcionou:
HtmlDataGrid listaIndex2 = new HtmlDataGrid();
public HtmlDataGrid listaIndex2(){
Session session = HibernateUtil.getSession();
Query q = session.createQuery(“from Produto”);
List<Produto> produtos = q.list();
return (HtmlDataGrid) produtos;
}
onde estou errando?
Erro:
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /Paginas/index2.jsp(20,32) #{…} is not allowed in template text
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102)