javax.el.PropertyNotFoundException访问JSF 2.2和RichFaces中的子类
我有JSF中的下一个组件:javax.el.PropertyNotFoundException访问JSF 2.2和RichFaces中的子类,richfaces,el,jsf-2.2,Richfaces,El,Jsf 2.2,我有JSF中的下一个组件: <rich:extendedDataTable value="#{userList}" var="obj" id="table"> <c:forEach items="#{columns}" var="column"> <rich:column width="#{column.width}"> <h:outputText value="#{obj[column.prope
<rich:extendedDataTable value="#{userList}" var="obj" id="table">
<c:forEach items="#{columns}" var="column">
<rich:column width="#{column.width}">
<h:outputText value="#{obj[column.property]}"/>
</rich:column>
</c:forEach>
</rich:extendedDataTable>
MyBean.java
String name;
UserType type;
// More attributes
// All these methods are properly implemented
public void setName(String name);
public void setType(UserType type);
public String getName();
public UserType getType();
在我的bean中,我用列初始化了下一个ArrayList,并从数据库中获得了一个用户列表
// Columns
List<Column> columns = new ArrayList<Column>();
columns.add(new Column("100", "name")); // String width, String property
columns.add(new Column("100", "type.name")); // String width, String property
// More columns
// Users
List<User> userList = db.getUsers();
问题:
如何访问子类“UserType”的属性“name”
谢谢。添加
公共字符串getTypeName()
似乎最简单
您告诉outputText查找名为type.name
的属性,它是一个字符串
javax.el.PropertyNotFoundException: The class 'my.package.User' does not have the property 'type.name'.
at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:661)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:290)