JSF Action Methods Not Invoking

I decided to upgrade one of the systems I support to JSF 2.  As if that wasn’t a large enough task, I decided while I’m at it, I would switch from MyFaces to Mojarra and dump Tomahawk while I’m at it.

After removing a lot of the Tomahawk components and the ExtensionsFilter servlet filter, I started to notice that many of my forms did not work anymore.  Clicking on the commandButtons or commandLinks within those forms would simply refresh the page but would not invoke the associated action.  Unfortunately for me, I had made a few dozen other changes besides removing Tomahawk, so the relationship between the two wasn’t that obvious at the time.

I had several forms that were declared like this:

<h:form enctype="multipart/form-data" id="sidebarForm">
...
</h:form>

There was no error message: upon submitting the form from a commandLink or commandButton, the page simply refreshed.  The request never invoked the action methods.  

The fix turned out to be rather simple.  Removing enctype=”multipart/form-data” fixed the problem.

Why was that there to begin with?  Well, because I used to use the Tomahawk inputFileUpload component to allow my clients to upload files.  The Tomahawk ExtensionsFilter allowed JSF to handle multipart form submissions before.

So this might not be likely to happen to anyone else, but if you ever decide to dump Tomahawk like I did, and suddenly notice your forms aren’t working, this might be why.