Search code examples
jsfjsf-2primefaces

javax.el.PropertyNotFoundException: The class doesn't have property


I am failing to render data which is surely in a database. All my DAO methods working and tested. Perhaps it is not important but anyway: I am using Primefaces, Java ee 6, glassfish 3.1.

Here is error: /edit.xhtml @59,45 value="#{b.orderNum}": The class 'com.boatmanagement.domain.BoatOrder' does not have the property 'orderNum'.

My domain class.

@Entity
@Table(name="BOAT_ORDR_TB")
public class BoatOrder implements Serializable
{
    @Id
    @GeneratedValue
    @Column(name="ORDER_PK")
    private int orderId;

    @Column(name="ORDER_NUM")
    private String orderNum;

    @Temporal(TemporalType.DATE) 
    @Column(name="ORDER_DATE")
    private Date orderDate;

    public int getBoatOrderId() {
        return orderId;
    }
    public void setBoatOrderId(int orderId) {
        this.orderId = orderId;
    }
    public String getBoatOrderNum() {
        return orderNum;
    }
    public void setBoatOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }
    public Date getBoatOrderDate() {
        return orderDate;
    }
    public void setBoatOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }
}

Here is part of my JSF page.

        <h:form class="displayTable">
            <p:dataTable id="boatTable" autoUpdate="true"
                var="b" value="#{filterbean.btOrderlist}">

                <p:column headerText="res. num" width="50">
                    <h:outputText value="#{b.orderNum}" />
                </p:column>

                <p:column headerText="Date" width="50">
                    <h:outputText value="#{b.orderDate}" />
                </p:column>

                <p:column headerText="Yacht name" width="100">
                    <h:outputText value="" />
                </p:column>

            </p:dataTable>
        </h:form>
    </ui:define>

Solution

  • The presence of the property is basically determined by the presence of the public getter method which is named according the Javabeans specification. So the property of orderNum basically requires a public getter with the name getOrderNum() (and for input components also a public setter with the name of setOrderNum()).

    You don't have them. You gave them different names. Fix the method names in the class, or the property name in EL.