Is this Primefaces bug or Mojarra/MyFaces bug

南楼画角 提交于 2019-12-02 08:55:43

It's a bug in your own code.

<partial-response>
  <error>
    <error-name>class javax.el.ELException</error-name>
    <error-message><![CDATA[/index.xhtml @15,84 selection="#{viewBean.selectedNode}": Cannot convert [Lorg.primefaces.model.TreeNode;@fd9b4d of type class [Lorg.primefaces.model.TreeNode; to interface org.primefaces.model.TreeNode]]></error-message>
  </error>
</partial-response>

The concrete exception message suggests that the <p:tree selection> is expected to refer a property of type TreeNode[] and not TreeNode (note the [ prefix on the class identifier in the message which indicates an array type). So, fix it accordingly:

<p:tree selection="#{treeBean.selectedNodes}">

with

private TreeNode[] selectedNodes;

Regardless, you've both the <p:tree> and <p:dataTable> inside the one and same "god" form. So any action in either of them will submit everything on the other component as well. If the tree and the table are in no way related to each other, then they should each be placed in its own <h:form>. Or, you must add a process attribute to the command links/buttons to process only the containing component of interest, e.g. process="mytable" on the button inside the table.

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