jsfseamjsf-1.2ajax4jsfseam2

Seam pages action is called before the h:commandButton action


I have this h:commandButton inside updatePerson.xhtml to update person informations but when I click it, the pages action method (controller.preUpdatePerson) is being called as if I was entering in this page again. I get even more lost with this call to pages action because objects inside controller.preUpdatePerson are null at this point and then it stops here.

controller.update is never called. I can't tell why this is happening. All entities and controllers are at conversation scope. I have tried many combinations and it does not seem a transaction problem. So what is happening here?

System specs.: Seam 2.2.2 JSF 1.2

pages.xml:

    <page view-id="/updatePerson.xhtml">
        <action execute="#{controller.preUpdatePerson}" on-postback="false" />
        <begin-conversation join="true" flush-mode="manual"/>

piece of updatePerson.xhtml:

<a4j:form id="editPerson" styleClass="inline" enctype="multipart/form-data">
<h:commandButton id="editPerson" value="#{messages['button.save']}" 
                    action="#{controller.update}"/>
...

Solution

  • Based on this answer commandButton/commandLink/ajax action/listener method not invoked or input value not updated my problem has to do with enctype="multipart/form-data" as the page submits file to upload. I had to configure the filters properly in the web.xml.