当表单 enctype 为 multipart/form-data 时,来自 f:param 的参数未随 AJAX 请求一起提交

Parameters from f:param not submitted with AJAX request when form enctype is multipart/form-data

我是 运行 Wildfly 8.2,我正在使用与其捆绑的 JSF 版本 2.2.8-jbossorg-1。

我有以下 facelet:

<h:form enctype="multipart/form-data">
    <h:commandButton value="Submit">
        <f:param name="myparam" value="true"/>
        <f:ajax execute="@this" render="@this"/>
    </h:commandButton>
</h:form>

当我按下提交按钮时,提交了几个参数,但没有提交 myparam。如果我从表单中删除 enctype="multipart/form-data",myparam=true 提交就好了。

有或没有enctype="multipart/form-data",如果我删除f:ajax,总是提交myparam=true。

为什么它在没有 enctype="multipart/form-data" 的情况下工作,但没有?我怎样才能让它工作?

这是 Mojarra 中的错误。我刚刚将其报告为 issue 3968.

目前,一种解决方法是将它们作为 EL 方法参数传递。

<h:form enctype="multipart/form-data">
    <h:commandButton value="Submit" action="#{bean.action(true)}">
        <f:ajax execute="@this" render="@this"/>
    </h:commandButton>
</h:form>
public void action(boolean myparam) {
    // ...
}