PrimeFaces commandButton in confirmDialog not calling backing bean

前端 未结 1 672
礼貌的吻别
礼貌的吻别 2020-12-31 18:06

I have a PrimeFaces data table that displays a set of users with a commandLink to delete on each row. When the link is clicked, a confirmDialog appears with a \"Yes\" button

相关标签:
1条回答
  • 2020-12-31 18:28

    The <p:confirmDialog ... appendToBody="true"> will cause the HTML representation of the confirm dialog to be relocated to end of HTML <body> element by JavaScript during DOM ready.

    This however causes that the HTML representation of the confirm dialog is not inside any form anymore. So effectively no form is been submitted and no request parameters are been sent and so JSF won't be able to idenfity the action.

    You need to give the confirm dialog its own <h:form>.

    <p:confirmDialog ...>
        <h:form>
            ...
        </h:form>
    </p:confirmDialog>
    

    And to avoid confusion during maintenance (nesting forms is namely illegal), I also suggest to move that component to end of template, at least after the "outer" <h:form>.

    0 讨论(0)
提交回复
热议问题