facebook

[Closed] javax.faces.el.PropertyNotFoundException

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238813 Reply

    bradm
    Member

    I have a managed bean called CustomerCollection that is declared like so in my faces-config file:

    <managed-bean>
    <managed-bean-name>CustomerCollection</managed-bean-name>
    <managed-bean-class>edu.unc.its.bs.CustomerID.CustomerCollection</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    This bean has an ArrayList called Customers (see below), which I bind to an HTMLDataTable in my jsp like so:

    <h:dataTable rows=”5″ value=”#{CustomerCollection.Customers}” var=”currentRow” binding=”#{SelectBacking.dataTable}”>

    When I view the app in a browser, I consistently get this error:

    javax.faces.el.PropertyNotFoundException: Error getting property ‘Customers’ from bean of type edu.unc.its.bs.CustomerID.CustomerCollection

    The code for the bean is below. What am I doing wrong? I have been staring at this for two days and I don’t see it. Note the main() method: the Customers array fills up just fine, just as it should. But the Faces runtime isn’t seeing it. Thanks in advance (this one has got to be obvious: I’m just not seeing it).

    package edu.unc.its.bs.CustomerID;

    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.Map;

    import javax.faces.context.FacesContext;

    public class CustomerCollection
    {
    static Connection con;
    static Statement stmt, stmt2;
    static ResultSet rs;
    FacesContext context;
    Map sessionMap;
    ArrayList Customers = new ArrayList();

    public CustomerCollection() throws SQLException
    {
    System.out.println(“In the CustomerCollection constructor”);
    getCustomerData(“2228”);//this method fills the Customers ArrayList with data
    }

    public static void main(String[] args) throws SQLException
    {
    CustomerCollection c = new CustomerCollection();
    c.getCustomerData(“2228”);
    System.out.println(“Total Customers: ” + c.Customers.size());
    Iterator i = c.Customers.iterator();
    while (i.hasNext())
    {
    Customer c2 = (Customer)i.next();
    System.out.println(c2.getContact());
    }
    }

    public void getCustomerData(String dept) throws SQLException
    {
    System.out.println(“In the getCustomerData() method”);
    try
    {
    DBCon db = new DBCon();
    con = db.getConnection();

    stmt = con.createStatement();
    String sql = “SELECT CustType,Dept,Requestor,RequestorNew,RequestorSfx,RequestorName,Contact,Contact_ph,contact_mc,” +
    “address1,address2,address3,city,state,zip,Funding_Code,AcctSuffix,frsMsg,CMoc_code,LastUsed,MailMergeContact,” +
    “MailMergeAddr1,MailMergeAddr2,MailMergeAddr3,CustomerStatus,DeptNullMCset FROM root.CustomerConversion ” +
    “WHERE dept = ” + dept;
    rs = stmt.executeQuery(sql);
    while (rs.next())
    {
    Customer c = new Customer();
    c.CustType = rs.getString(1);
    c.Dept = rs.getString(2);
    c.Requestor = rs.getString(3);
    c.RequestorNew = rs.getString(4);
    c.RequestorSfx = rs.getString(5);
    c.RequestorName = rs.getString(6);
    c.Contact = rs.getString(7);
    c.Contact_ph = rs.getString(8);
    c.contact_mc = rs.getString(9);
    c.address1 = rs.getString(10);
    c.address2 = rs.getString(11);
    c.address3 = rs.getString(12);
    c.city = rs.getString(13);
    c.state = rs.getString(14);
    c.zip = rs.getString(15);
    c.Funding_Code = rs.getString(16);
    c.AcctSuffix = rs.getString(17);
    c.frsMsg = rs.getString(18);
    c.CMoc_code = rs.getString(19);
    c.LastUsed = rs.getString(20);
    c.MailMergeContact = rs.getString(21);
    c.MailMergeAddr1 = rs.getString(22);
    c.MailMergeAddr2 = rs.getString(23);
    c.MailMergeAddr3 = rs.getString(24);
    c.CustomerStatus = rs.getString(25);
    c.DeptNullMCset = rs.getString(26);

    Customers.add(c);
    }
    System.out.println(“Customers size = ” + Customers.size());//just to prove it’s working! It is!
    }
    catch (SQLException ex)
    {
    ex.printStackTrace();
    }
    catch (Exception ex)
    {
    ex.printStackTrace();
    }
    finally
    {
    stmt.close();
    rs.close();
    con.close();
    }
    }

    public ArrayList getCustomers()
    {
    return Customers;
    }

    public void setCustomers(ArrayList customers)
    {
    Customers = customers;
    }
    }

    #238828

    bradm
    Member

    AHHHH: I see it now. ALWAYS name your variables starting with lower case letters (otherwise your get/sets won’t work). I knew that….

    Humbled. Sorry for the intrusion.

    #238873

    Riyad Kalla
    Member

    Thank you for following up for others.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] javax.faces.el.PropertyNotFoundException

You must be logged in to post in the forum log in