我是初脸的新人。请参阅下面的代码。
Test.xhtml
<h:dataTable var="test" value="#{generalServiceBean.orderList}" >
<h:column>
<f:facet name="header">Order No</f:facet>
</h:column>
<h:column>
<f:facet name="header">Order No</f:facet>
<h:outputText value="#{test.orderNo}" />
</h:column>
</h:dataTable>
Testbean.java
package my.com.mesiniaga.sphere.web;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.faces.application.Application;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import my.com.mesiniaga.sphere.domain.GeneralEc;
import my.com.mesiniaga.sphere.domain.Groups;
import org.primefaces.component.datatable.DataTable;
import org.primefaces.component.message.Message;
import org.primefaces.component.outputlabel.OutputLabel;
import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox;
import org.primefaces.model.LazyDataModel;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.roo.addon.jsf.managedbean.RooJsfManagedBean;
import org.springframework.roo.addon.serializable.RooSerializable;
import java.io.Serializable;
import java.math.BigDecimal;
@RooSerializable
@RooJsfManagedBean(entity = GeneralEc.class, beanName = "generalServiceBean")
public class GeneralServiceBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String title ="General Eligibility ";
private static final ArrayList<Order> orderList =
new ArrayList<Order>(Arrays.asList(
new Order("A0001", "Intel CPU",
new BigDecimal("700.00"), 1),
new Order("A0002", "Harddisk 10TB",
new BigDecimal("500.00"), 2),
new Order("A0003", "Dell Laptop",
new BigDecimal("11600.00"), 8),
new Order("A0004", "Samsung LCD",
new BigDecimal("5200.00"), 3),
new Order("A0005", "A4Tech Mouse",
new BigDecimal("100.00"), 10)
));
public ArrayList<Order> getOrderList() {
return orderList;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public static class Order{
String orderNo;
String productName;
BigDecimal price;
int qty;
boolean editable;
public Order(String orderNo, String productName, BigDecimal price, int qty) {
this.orderNo = orderNo;
this.productName = productName;
this.price = price;
this.qty = qty;
}
//getter and setter methods
}
}
我需要从testbean.java获取数据。但我无法在数据表中显示我的数据。这是我得到的错误
javax.el.PropertyNotFoundException: Property 'Order' not found on type my.com.mesiniaga.sphere.web.GeneralServiceBean$Order
viewId=/pages/generalEc.xhtml
location=D:\springsource\vfabric-tc-server-developer-2.8.2.RELEASE\base-instance\wtpwebapps\CGC_Dev\pages\generalEc.xhtml
phaseId=RENDER_RESPONSE(6)
Caused by:
javax.el.PropertyNotFoundException - Property 'orderNo' not found on type my.com.mesiniaga.sphere.web.GeneralServiceBean$Order
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237)
有人得到解决方案吗?