11 Replies Latest reply on Feb 17, 2007 5:35 PM by Dennis Hanslik

    Partial steps to get file upload running, final step doesn't

    David Sanchez Novice

      This all follows from Ronalds link below. I spent the day taking the ball and running with it from there and this is what I discovered. I'm not quite home yet, file doesn't seem to actually upload but I think I'm close. Have at it I'll add more when I figure out the final solution.

      http://myfaces.apache.org/tomahawk/fileUpload.html


      1. You need to following files:

      tomahawk.jar
      commons-fileupload-1.0.jar
      fileupload.jsp
      FileUploadForm.java

      (at the bottom are some links to help you find the above)

      2. I recommend putting the jars in the jbpm.3/lib/commmons directory

      3. Modify the build.deploy.xml at about line 112 so those files find their way into the WEB-INF directory

      4. Put the FileUploadForm.java with the Beans at jbpm.3/src/java.webapp/jbpm.war/org/jbpm/webapp/bean

      5. Edit the package name at the top of the file to:
      org.jbpm.webapp.bean


      6. Put the "fileupload.jsp" with the other jsps (jbpm.3/src/resources/java.webapp/

      7. Modify the faces-config.xml

      <!-- Managed Beans for fileupload.jsp -->

      <managed-bean>
      <managed-bean-name>fileUploadForm</managed-bean-name>
      <managed-bean-class>org.jbpm.webapp.bean.FileUploadForm</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>

      <!-- Navigation rule for fileupload.jsp -->

      <navigation-rule>
      <from-view-id>/home.jsp</from-view-id>
      <navigation-case>
      <from-outcome>upload_download</from-outcome>
      <to-view-id>/fileupload.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>

      8. Add the following to the home.jsp to give it a button that takes you to the upload/download page

      <h4>Upload or download a file</h4>
      <h:form id="upload">
      <h:commandButton action="upload_download" value="Upload/Download Page"/>

      Here are the links I promised to the files above....

      http://myfaces.apache.org/binary.cgi
      download...
      myfaces-1.1.0.zip (or .tar.gz)
      ..to get..
      /myfaces-1.1.0/tomahawk.jar


      http://jakarta.apache.org/site/downloads/downloads_commons-fileupload.cgi
      ..to get..
      commons-fileupload-1.0.jar


      http://myfaces.apache.org/source.cgi
      ..to get..
      /myfaces-1.1.0-src/webapps/examples
      fileupload.jsp

      same as above..to get..
      /myfaces-1.1.0-src/webapps/src/example/org/apache/myfaces/examples/misc/FileUploadForm.java