我正在使用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上访问它。我究竟做错了什么???
答案 0 :(得分:1)
您的商标名称是订单,而不是订单。
答案 1 :(得分:0)
您在OrderHistory中以小写字母声明了变量“order” 但是你试图访问变量“Order”。 而不是“$ {OrderHistory.Order}”可以尝试“$ {OrderHistory.order}”