2 Replies Latest reply on Sep 22, 2008 10:48 AM by Alex Ivan

    a4j:support don't invoke action within rich:fileUpload

    Alex Ivan Newbie

      Hi all.
      I have some troubles with <rich:fileUpload>.
      1) if i put <a4j:support action="#{test.actionTest}"> in it, this action is not invoked.
      2) some fields are changed during request, but client not refresh theirs.

      this is my page:

      <f:view>
       <h:form>
       <rich:panel id="uploadPanel">
      
       <rich:fileUpload id="upload"
      
       acceptedTypes="dbf"
       autoclear="false"
       disabled="false"
      
       required="true"
       requiredMessage="Empty input..."
      
       fileUploadListener="#{test.fileUploadListener}"
       immediateUpload="false"
       maxFilesQuantity="1"
       noDuplicate="true"
       rendered="#{test.state=='uploading'}"
       uploadData="#{test.uploadedFiles}"
      
       listWidth="700px"
       listHeight="174px">
      
       <a4j:support event="onuploadcomplete"
       oncomplete="alert('oncomplete action')"
       action="#{test.actionTest}"
       reRender="info"
       />
       </rich:fileUpload>
      
       <a4j:outputPanel id="info">
       <h:outputText value="state: #{test.state}"/>
      
       <rich:panel rendered="#{test.state=='completed'}">
       <h:outputText value="File has been uploaded."/>
       </rich:panel>
       </a4j:outputPanel>
      
       </rich:panel>
       </h:form>
       <a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;"></a4j:log>
      </f:view>
      
      


      this is my bean:

      public class TestBean {
      
       private static final Logger LOGGER = Logger.getLogger( TestBean.class.getName() );
      
       private static final String STATE_UPLOADING = "uploading";
       private static final String STATE_COMPLETED = "completed";
      
       private String state;
       private List<UploadItem> uploadedFiles;
      
       public TestBean() {
       state = STATE_UPLOADING;
       uploadedFiles = new ArrayList<UploadItem>();
       }
      
       public void fileUploadListener( UploadEvent event ) throws IOException {
      
       UploadItem item = event.getUploadItem();
      
       if ( item != null ) {
       LOGGER.info( "File has been uploaded." );
       this.state = STATE_COMPLETED;
       }
       }
      
       public String getState() {
       return state;
       }
      
       public List getUploadedFiles() {
       return uploadedFiles;
       }
      
      
       public String actionTest(){
       LOGGER.info( "action" );
       return null;
       }
      }
      
      


      I need your help :)