2 Replies Latest reply on Feb 17, 2011 12:09 PM by ds_dev

    Problem with rich:fileUpload with View Scoped managed bean

    ds_dev

      Hi everyone,

       

      We're facing an issue using the rich:fileUpload component. Our goal is to execute a script after a file upload. The script to execute must be specified in the xhtml page because it is not always the same.

       

      To do this, we tried to set a managed bean attribute using <a4j:actionparam> like this :

       

      <rich:fileUpload fileUploadListener="#{visu.uploadListener}" autoclear="false">
       <a4j:support event="onadd">
       <a4j:actionparam name="script"
       value="scriptPath"
       assignTo="#{bean.script}" />
       </a4j:support>
      </rich:fileUpload
      

       

      Unfortunately, our managed bean is in view scope and the file upload component seems to break the view scope by creating a new managed bean although we're still in the same view scope (same page) or maybe i'm mistaken here.

       

      Anyway, that should work OK but we have an init method that sets a default script to be executed when the bean is created overriding what was passed from the xhtml page.

       

      The question is : Are we doing anything wrong ? Is it normal that the fileUpload component breaks the view scope ?

      How can we work around this problem in an elegant way ?

       

      We're using Richfaces 3.3.3 for JSF 2 with MyFaces 2.0.2 in Glassfish 2.1.

       

      Thanks a lot for your feedback.