3 Replies Latest reply on Jul 31, 2009 5:49 AM by ilya_shaikovsky

    FileUpload bean and scope

    bennyboy

      hello

      I'm currently playing with the rich:fileUpload component.
      It's working fine, but you have to use a session bean to have it morking fine, is there a way to use a request scope instead ?
      I tried to keep the bean alive with a4j:keepAlive tag, but no way, it keeps creating new instances of my bean.

        • 1. Re: FileUpload bean and scope
          ilya_shaikovsky

          you could keep the bean with listener in request scope. Just outject the data uploaded from listener to store it.

          • 2. Re: FileUpload bean and scope
            bennyboy

            I don't get it, can you please explain a bit more?
            If i put the bean with the fileUploadListener as a request bean it's not working fine , the a4j:mediaOutput can't display images preview (i'm trying to do the same thing as shown in the live demo), as the fileList is always null (bean is created each time i upload something).
            With a session scope, it's working perfectly.

            thanks.

            • 3. Re: FileUpload bean and scope
              ilya_shaikovsky

              yes, request scoped bean is recreated on every request. Thats why you should store the uploaded files in some session scoped bean, db or something else from listener.