JSF: p:dataTable with f:attribute results in “argument type mismatch” error

左心房为你撑大大i 提交于 2019-12-11 09:31:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!