Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF Datatable does not show all List fields(columns)
    text
    copied!<p>I want to display a table in JSF:DataTAble. I successfully retrived table from database to List of users type where "users" is my pojo class. Now I am having problem with displaying it on data table some of the columns like FName, LName, Pwd, displayed correctly but when i add other coulmns like "Note" "Email" it gives me this error</p> <pre><code>javax.servlet.ServletException: /dt.xhtml: Property 'Email' not found on type in.ali.pojo.users javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) root cause javax.el.ELException: /dt.xhtml: Property 'Email' not found on type in.ali.pojo.users com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88) com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302) com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:385) com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:162) javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443) com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) </code></pre> <p>here is my xhtml page</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;h:head&gt; &lt;title&gt;Facelet Title&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:dataTable value="#{pretechDataTableBean.user}" var="users"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;Name&lt;/f:facet&gt; #{users.FName} &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;Email&lt;/f:facet&gt; #{users.Email} &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;Password&lt;/f:facet&gt; #{users.pwd} &lt;/h:column&gt; &lt;/h:dataTable&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>here is my PretechDataTableBean which i used for retrieving data from DB</p> <pre><code>package com.pretech; import in.ali.pojo.users; import in.ali.util.HibernateUtil; import java.util.List; import org.hibernate.Session; import org.hibernate.Transaction; import java.util.ArrayList; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; /** * * @author vinod */ @ManagedBean @RequestScoped public class PretechDataTableBean { public PretechDataTableBean() { } public List&lt;users&gt; getUser() { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction transaction = null; List&lt;users&gt; users =null; try { transaction = session.beginTransaction(); users = session.createQuery("from users").list(); } catch(Exception e) { e.printStackTrace(); } finally{ session.close(); } return users; } } </code></pre> <p>This is my users pojo</p> <pre><code>package in.ali.pojo; // Generated Sep 28, 2013 3:55:01 PM by Hibernate Tools 4.0.0 /** * users generated by hbm2java */ public class users implements java.io.Serializable { private long UserId; private String FName; private String LName; private long UserTypeId; private String UserName; private String Email; private String Pwd; private String Note; private boolean IsActive; public users() { } public users(long UserId) { this.UserId = UserId; } public users(long UserId, String FName, String LName, long UserTypeId, String UserName, String Email, String Pwd, String Note, boolean IsActive) { this.UserId = UserId; this.FName = FName; this.LName = LName; this.UserTypeId = UserTypeId; this.UserName = UserName; this.Email = Email; this.Pwd = Pwd; this.Note = Note; this.IsActive = IsActive; } public long getUserId() { return this.UserId; } public void setUserId(long UserId) { this.UserId = UserId; } public String getFName() { return this.FName; } public void setFName(String FName) { this.FName = FName; } public String getLName() { return this.LName; } public void setLName(String LName) { this.LName = LName; } public long getUserTypeId() { return this.UserTypeId; } public void setUserTypeId(long UserTypeId) { this.UserTypeId = UserTypeId; } public String getUserName() { return this.UserName; } public void setUserName(String UserName) { this.UserName = UserName; } public String getEmail() { return this.Email; } public void setEmail(String Email) { this.Email = Email; } public String getPwd() { return this.Pwd; } public void setPwd(String Pwd) { this.Pwd = Pwd; } public String getNote() { return this.Note; } public void setNote(String Note) { this.Note = Note; } public boolean isIsActive() { return this.IsActive; } public void setIsActive(boolean IsActive) { this.IsActive = IsActive; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload