javax.el.PropertyNotFoundException:在类型mine.domain.OrderHistory上找不到属性'Order'

时间:2012-08-25 11:43:57

标签: java jsp exception properties

我正在使用jaxb将我的xml转换为java bean。我有orderhistory类,它将有订单列表。我在jsp中获取bean但是当我尝试使用时, <c:forEach items="${OrderHistory.Order}" var="orderInfo">我得到javax.el.PropertyNotFoundException: Property 'Order' not found on type mine.domain.OrderHistory这是我的orderhistory.java,

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
    "totalPages",
    "order",
     })
    @XmlRootElement(name = "OrderHistory")
    public class OrderHistory
    implements Serializable
     {

private final static long serialVersionUID = -6026937020915831338L;

protected int totalPages;
@XmlElement(nillable = true)
protected List<Order> order;


public List<Order> getOrder() {
    if (order == null) {
        order = new ArrayList<Order>();
    }
    return this.order;
}

   OrderHistory oh = // i am populating it here 
   TypedProperty responseProperties = new TypedProperty();
responseProperties.put("OrderHistory",oh);
    setResponseProperties(responseProperties);

我能够在java端看到orderhistory bean中填充的订单列表,但我无法在jsp上访问它。我究竟做错了什么???

2 个答案:

答案 0 :(得分:1)

您的商标名称是订单,而不是订单。

答案 1 :(得分:0)

您在OrderHistory中以小写字母声明了变量“order”  但是你试图访问变量“Order”。 而不是“$ {OrderHistory.Order}”可以尝试“$ {OrderHistory.order}”