使用MyFaces 1.2.12和Rich Faces 3.3.3我有一个富有的重复模式:这样的列:
<rich:column label="my column name"
sortable="true"
selfSorted="true"
sortBy="#{entity.attribute}"
filterBy="#{entity.attribute}"
filterEvent="onkeyup">
<f:facet name="header">
<h:outputText value="my column name"/>
</f:facet>
<h:outputText value="#{entity.attribute}"/>
</rich:column>
每列的列名称和entity.attribute
都会更改。过滤和排序工作正常。
但是,每列的重复都很繁琐,因此我尝试将其替换为自定义标记mytags:filterableSortableColumn
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich">
<!--@elvariable id="label" type="java.lang.String"-->
<!--@elvariable id="item" type="java.lang.Object"-->
<rich:column label="#{label}"
sortable="true"
sortBy="#{item}"
selfSorted="true"
filterBy="#{item}"
filterEvent="onkeyup">
<f:facet name="header">
<h:outputText value="#{label}"/>
</f:facet>
<h:outputText value="#{item}"/>
</rich:column>
</ui:composition>
像这样使用:
<mytags:filterableSortableColumn label="my column name" item="#{entity.attribute}"/>
这适用于数据显示和列标题,但是当使用数据表进行过滤或排序时,我得到一个异常(来自hibernate,顺便说一下):
Unable to locate Attribute with the the given name [#{item] on this ManagedType [com.example.entity.Entity]
[#{item]
应该在此之前解决。
这可能是我在表格及其列之间的互动中未能解释的事情吗?