问题
I want to add conditionally add some arguments to a p:dataTable like described in Conditionally render element's attribute in a composite component. But even without the c:if I get an java.lang.IllegalArgumentException: argument type mismatch (Stacktrace on pastebin).
...
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
...
<p:dataTable var="r" value="#{myBean.values}" >
<f:attribute name="paginator" value="true" />
</p:dataTable>
The error does not occur (and the paginator is available) if I add the attribute directly <p:dataTable ... paginator="true">.
My environment is Primefaces 3.4.1 with JBoss 7.1.1-Final.
回答1:
Try passing it as EL object:
<f:attribute name="paginator" value="#{true}" />
来源:https://stackoverflow.com/questions/13006322/jsf-pdatatable-with-fattribute-results-in-argument-type-mismatch-error