Announcement Announcement Module
Collapse
No announcement yet.
SWF + JSF file upload Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SWF + JSF file upload

    Which components are better to use for uploading files in SWF 2.0 + JSF applications? Which are definetly work? Please share your experience

    Thank in advance.

  • #2
    I have used the myfaces tomahawk file upload component for years. The max file size is adjustable in web descriptor. I works very well and is easy to configure and use.

    I have also used richfaces 3.2.x file upload - very nice. The richfaces file upload is only available in version 3.2.x (requires JSF 1.2 features). They do not have a file upload component in version 3.1.x (JSF 1.1).

    Comment


    • #3
      Originally posted by lbbisho View Post
      I have used the myfaces tomahawk file upload component for years. The max file size is adjustable in web descriptor. I works very well and is easy to configure and use.
      I'm using tomahawk file upload too and it works but not the max file size. I don't know why? My config is:
      Code:
              <filter>
              <filter-name>MyFacesExtensionsFilter</filter-name>
              <filter-class>
                  org.apache.myfaces.webapp.filter.ExtensionsFilter
              </filter-class>
              <init-param>
                  <param-name>uploadMaxFileSize</param-name>
                  <param-value>7m</param-value>            
              </init-param>
              <init-param>
                  <param-name>uploadThresholdSize</param-name>
                  <param-value>100k</param-value>
              </init-param>
          </filter>
      Are u sure the max file size is working under SWF?

      Comment


      • #4
        Hi,


        I'm using the richfaces file upload component. It works, but it always shows a message that saying that the upload was not sucefull, if you manage to ignore this message it will be usefull.


        Pedro

        Comment


        • #5
          Hi, Pedro, tanks for reply

          I also use rich:fileUpload and get the same issue. It works, but error message appears.

          Comment


          • #6
            Originally posted by pccampos View Post
            Hi,
            I'm using the richfaces file upload component. It works, but it always shows a message that saying that the upload was not sucefull, if you manage to ignore this message it will be usefull.
            I'm having troubles to get it to work. Could you post the flow or other relevant parts of the config?

            Regards,

            Comment


            • #7
              Ok,

              First, we need to config the upload component on web.xml, in this case I only set that a temp file must be created on the upload:

              Code:
              	<filter> 
              		<display-name>RichFaces Filter</display-name> 
              		<filter-name>richfaces</filter-name> 
              		<filter-class>org.ajax4jsf.Filter</filter-class> 
              		<init-param>
              			<param-name>createTempFiles</param-name>
              			<param-value>true</param-value>
              		</init-param>
              	</filter>
              Then we add the component to the xhtml or jsp:

              Code:
              <rich:fileUpload listHeight="58" immediateUpload="true" fileUploadListener="#{fileUpload.listener}"/>
              In this case I set the FileUpload class as a service bean (@Service) and implemented a listerner method:

              Code:
              	public synchronized void listener(UploadEvent event) throws Exception {
              		UploadItem item = event.getUploadItem();
              		String uuid = jcrService.createFile(item.getFile(), item.getContentType());
              		if (context instanceof CarType) {
              			CarType carType = (CarType) context;
              			carType.setImage(uuid);
              		}
              	}
              As I said the file is uploaded, I can save it on the JCR repository, but I had the error message on the component and the carType bean is not set, actually is set, but in the end of the flow carType.image is null (and I'm preety sure that after carType.setImage(uuid) a value is on the property).

              No need to add further configuration on the flow.


              I hope this will help you,
              Pedro Casagrande

              Comment


              • #8
                Thanks. In fact, it was working (my fault!). Using a model bean instead of a Service stores the file correctly.

                Regards,

                Comment


                • #9
                  Have you got it working? I've moved the listener method to my @Entity bean but I still got the "Transfer error occuried" message.

                  Originally posted by xmaniac View Post
                  Thanks. In fact, it was working (my fault!). Using a model bean instead of a Service stores the file correctly.

                  Regards,

                  Comment


                  • #10
                    The transfer error still shows (I'll hide it with CSS prolly) but the item is available at the end of the flow. So good enough for me

                    Comment

                    Working...
                    X