javax.el.propertynotfoundexception:在类型mine.domain.orderhistory上找不到属性“order”

3df52oht  于 2021-07-09  发布在  Java
关注(0)|答案(2)|浏览(282)

我正在使用jaxb将xml转换为javabean。我有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端看到orderhistorybean中填充的订单列表,但无法在jsp上访问它。我做错什么了???

1cosmwyk

1cosmwyk1#

您的财产名称是order,而不是order。

pexxcrt2

pexxcrt22#

您在orderhistory类中用小写字母声明了变量“order”,但您正在尝试访问变量“order”。代替“${orderhistory.order}”,您可以尝试“${orderhistory.order}”

相关问题