Using fileUpload (either <gd:inputFile.. or <rich:fileUpload
neal Oct 3, 2008 6:47 AMI am trying to implement file upload functionality (like a document variable) from within a task form. I tried using gravel or richFaces and both are not working
1) Gravel
1.a) The form has the following tags
<ui:component> <jbpm:dataform> <f:facet name="header"> <h:outputText value="#{taskName}"/> </f:facet> <!-- TASKFORM ROWS --> <jbpm:datacell> <f:facet name="header"> <h:outputText value="Test1"/> </f:facet> <h:inputText id="useraddress" value="#{var['Test1']}" required="true"> </h:inputText> <gd:inputFile target="#{var['teststream']}" maxSize="104857600"/> </jbpm:datacell> <jbpm:datacell> <f:facet name="header"> <h:outputText value="Actions"/> </f:facet> <!-- TASKFORM BUTTONS --> <tf:saveButton value="Save"/> <tf:cancelButton value="Cancel"/> <tf:transitionButton transition="ToApproval" value="ToApproval"/> </jbpm:datacell> </jbpm:dataform> <h:messages style="color:darkred"/> </ui:component>
1.b) I dont get any error while clicking on the save button in the form but I also don't see the variable "teststream" when I check for the process instance variables. I believe that the form should have enctype="multipart/form-data" to be able to use the gravel fileUpload but I am not sure how I should do that since there is no documentation for jbpm:dataform and am not sure if it takes the form encoding as a parameter for the tag.
2) RichFaces
---------------
2.a) the form includes the following tag
<ui:component> <jbpm:dataform> <f:facet name="header"> <h:outputText value="#{taskName}"/> </f:facet> <!-- TASKFORM ROWS --> <jbpm:datacell> <f:facet name="header"> <h:outputText value="Test1"/> </f:facet> <h:inputText id="useraddress" value="#{var['Test1']}" required="true"> </h:inputText> <rich:fileUpload uploadData="#{myfiles}"/> </jbpm:datacell> <jbpm:datacell> <f:facet name="header"> <h:outputText value="Actions"/> </f:facet> <!-- TASKFORM BUTTONS --> <tf:saveButton value="Save"/> <tf:cancelButton value="Cancel"/> <tf:transitionButton transition="ToApproval" value="ToApproval"/> </jbpm:datacell> </jbpm:dataform> <h:messages style="color:darkred"/> </ui:component>
2.b) When clicking on the upload button I get a "Transfer error" with the following exception on the server console
SEVERE: Error Rendering View[/sa/task.xhtml] java.lang.IllegalArgumentException at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBa se.java:1590) at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBa se.java:1499) at org.jboss.gravel.action.handler.AttributeHandler.apply(AttributeHandl er.java:106) at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa : : 15:55:19,925 ERROR [LazyInitializationException] could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Sessi on at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyIn itializer.java:57) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(Abstrac tLazyInitializer.java:111) : : : 15:55:20,050 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.sun.faces.con ext.FacesContextImpl@ccdcea) threw exception java.lang.NullPointerException at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:168) at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:145) at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:109) : :
2.c) My web.xml has the following
<context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <init-param> <param-name>createTempFiles</param-name> <param-value>true</param-value> </init-param>
2.d) And the faces-config.xml has the following
<application> <locale-config> <default-locale>en</default-locale> </locale-config> <!-- Use Facelets as the primary view handler. Since we have bookmarkable URLs, add Gravel's query preserving view handler to the list. --> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> <view-handler>org.jboss.gravel.QueryPreservingViewHandler</view-handler> <!-- Use Gravel's navigation model. --> <navigation-handler>org.jboss.gravel.navigation.GravelNavigationHandler</navigation-handler> </application>