Bjørn Stenfeldt
Bjørn Stenfeldt

Reputation: 1602

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

I'm running Wildfly 8.2 and I'm using the JSF version bundled with it, 2.2.8-jbossorg-1.

I have the following 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>

When I press the submit button, several parameters are submitted, but not myparam. If I remove enctype="multipart/form-data" from the form, myparam=true is submitted just fine.

With or without enctype="multipart/form-data", if I remove f:ajax, myparam=true is always submitted.

Why is it working without enctype="multipart/form-data", but not with? And how can I get it to work?

Upvotes: 3

Views: 549

Answers (1)

BalusC
BalusC

Reputation: 1108912

This is a bug in Mojarra. I've just reported it as issue 3968.

For now, one work around is to pass them as EL method arguments instead.

<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) {
    // ...
}

Upvotes: 4

Related Questions