As far as I understood, specifying IDs in the execute
of an f:ajax
tag should limit the fields which are posted to the server.
<h:form>
<h:inputText id="one" value="#{manageSettingsBean.testOne}"/>
<h:inputText id="two" value="#{manageSettingsBean.testTwo}"/>
<h:commandButton value="Multi test" action="#{maintainEntityAction.multi(manageSettingsBean.testOne, manageSettingsBean.testTwo)}">
<f:ajax execute="@this one"/>
</h:commandButton>
</h:form>
In this case, I'd expect that only the first inputText
would be submitted.
On examining the form data in Chrome's Network tab, however, I see
j_idt13=j_idt13&j_idt13%3Aone=One&j_idt13%3Atwo=Two&javax.faces.ViewState=-8624538035389330252%3A2147742525648157763&javax.faces.source=j_idt13%3Aj_idt14&javax.faces.partial.event=click&javax.faces.partial.execute=j_idt13%3Aj_idt14%20j_idt13%3Aone&javax.faces.behavior.event=action&javax.faces.partial.ajax=true
Which contains both components, with their default values (of "One"
and "Two"
).
j_idt13:one=One
j_idt13:two=Two
The first component is specified in the javax.faces.partial.execute
, so it is the only one that is updated, but both fields do seem to be submitted. I'm doing the partial submit as part of a large form to avoid posting up too much data, but the benefit would appear to be lost if the entire form is still being submitted?