javax.el.PropertyNotFoundException:在类型entity.Authors上找不到属性'AuthFirstName'

时间:2012-04-22 23:03:22

标签: java jsp jstl el propertynotfoundexception

实体:

package entity;

import java.io.Serializable;

public class Authors implements Serializable {

    private String AuthFirstName;

    public Authors() {
    }

    public String getAuthFirstName() {
        return AuthFirstName;
    }

    public void setAuthFirstName(String AuthFirstName) {
        this.AuthFirstName = AuthFirstName;
    }

}

的Servlet

 List listAuthors = authDAO.findAuthors();
 request.setAttribute("lista", listAuthors);

JSP:

<c:forEach var="var" items="${lista}">
    <c:out value="${var.AuthFirstName}"/>
</c:forEach>

例外:

  

javax.el.PropertyNotFoundException:在类型entity.Authors上找不到属性'AuthFirstName'

这是如何引起的?如何解决?

1 个答案:

答案 0 :(得分:4)

它应该以小写字母开头。

<c:out value="${var.authFirstName}" />

此外,将底层属性名称修复为以小写字母开头也是很好的,尽管它在功能上没有坏处。

private String authFirstName;

另见: