Nov. 9, 2010, 11:35 a.m.
IT

JBoss Seam s:fileUpload and null data

Sometimes I can be a real schmuck. Some people believe I always am one, but in this case it was a 30 minute lapse in neuron activity. I had a JBoss Seam xhtml JSF page like this:

However it ALWAYS returned null for noteManagement.restoreNotesData which is a byte[] property on the noteManagement seam component. The reason? Idiot me forgot to wrap that s:fileUpload in a separate form element declared as a multipart form:

 id="restore_notes_form" enctype="multipart/form-data">
   ...

After adding that, file uploads worked beautifully. Of course you still have to have this in components.xml:

<component class="org.jboss.seam.web.MultipartFilter">
   <property name="createTempFiles">true</property>
   <property name="maxRequestSize">1000000</property>
</component>