ICEfaces
  1. ICEfaces
  2. ICE-8859

FileEntryComponent does not work on Myfaces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      JBoss 7.1.1 Final
      MyFaces 2.1.9
    • Assignee Priority:
      P2
    • Workaround Description:
      Hide
      Execute this code one time in your application:

      if (EnvUtils.isMyFaces()) {
      Application application = FacesContext.getCurrentInstance().getApplication();
      application.subscribeToEvent(PreRenderComponentEvent.class, null, new FileEntryFormSubmit());

      PhaseListener phaseListener = new FileEntryPhaseListener();
      LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
      for (Iterator<String> ids = lifecycleFactory.getLifecycleIds(); ids.hasNext();) {
      Lifecycle lifecycle = lifecycleFactory.getLifecycle(ids.next());
      // Remove all other PhaseListeners, and re-add them after
      // FileEntryPhaseListener, since they'll likely rely on it having
      // setup a valid environment for JSF. Eg: WindowScopeManager.
      // This also allows FileEntryPhaseListener to add FacesMessages
      // for FileEntry components with immediate=false in PreRender
      // before the core FacesMessagesPhaseListener works in PreRender.
      PhaseListener[] phaseListeners = lifecycle.getPhaseListeners();
      for (PhaseListener otherPhaseListener : phaseListeners) {
      lifecycle.removePhaseListener(otherPhaseListener);
      }
      lifecycle.addPhaseListener(phaseListener);
      for (PhaseListener otherPhaseListener : phaseListeners) {
      lifecycle.addPhaseListener(otherPhaseListener);
      }
      }
      }
      Show
      Execute this code one time in your application: if (EnvUtils.isMyFaces()) { Application application = FacesContext.getCurrentInstance().getApplication(); application.subscribeToEvent(PreRenderComponentEvent.class, null, new FileEntryFormSubmit()); PhaseListener phaseListener = new FileEntryPhaseListener(); LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); for (Iterator<String> ids = lifecycleFactory.getLifecycleIds(); ids.hasNext();) { Lifecycle lifecycle = lifecycleFactory.getLifecycle(ids.next()); // Remove all other PhaseListeners, and re-add them after // FileEntryPhaseListener, since they'll likely rely on it having // setup a valid environment for JSF. Eg: WindowScopeManager. // This also allows FileEntryPhaseListener to add FacesMessages // for FileEntry components with immediate=false in PreRender // before the core FacesMessagesPhaseListener works in PreRender. PhaseListener[] phaseListeners = lifecycle.getPhaseListeners(); for (PhaseListener otherPhaseListener : phaseListeners) { lifecycle.removePhaseListener(otherPhaseListener); } lifecycle.addPhaseListener(phaseListener); for (PhaseListener otherPhaseListener : phaseListeners) { lifecycle.addPhaseListener(otherPhaseListener); } } }

      Description

      It is unable to upload any file with the FileEntryComponent: The required validator message is shown.

      <ace:fileEntry id="inputFileName"
      fileEntryListener="#{applicationController.uploadFile}"
      relativePath="/upload/" required="true" useOriginalFilename="true"
      useSessionSubdir="true" />

      <h:commandButton type="submit" id="commandButtonUpload"
      styleClass="iceCmdBtn __ontoBouton"
      value="Upload" />

      <ice:message id="inputFileMessage" for="inputFileName"
      style="display:block;" escape="false" />

      I can see in Firefug that the file content is not send in the querry.

        Activity

        Hide
        Patrick Guerin added a comment -

        Joined a winmerge screenshot showing differences between two generated pages with mojarra (on the left) and myfaces (on the right)

        Uploading files work fine with mojarra but not with myfaces...

        Show
        Patrick Guerin added a comment - Joined a winmerge screenshot showing differences between two generated pages with mojarra (on the left) and myfaces (on the right) Uploading files work fine with mojarra but not with myfaces...
        Hide
        Mark Collette added a comment -

        The work-around suggests that the org.icefaces.ace.component.fileentry.FileEntryLoader is not running in MyFaces but is in Mojarra. We'll need to test to confirm this.

        Show
        Mark Collette added a comment - The work-around suggests that the org.icefaces.ace.component.fileentry.FileEntryLoader is not running in MyFaces but is in Mojarra. We'll need to test to confirm this.
        Hide
        Mark Collette added a comment -

        QA has tested trunk and ICEfaces 3.2 fileEntry in showcase built with MyFaces, and all scenarios work. There might be some application configuration issue that this jira creator is experiencing. I would recommend supplying a complete tomcat7 war.

        Show
        Mark Collette added a comment - QA has tested trunk and ICEfaces 3.2 fileEntry in showcase built with MyFaces, and all scenarios work. There might be some application configuration issue that this jira creator is experiencing. I would recommend supplying a complete tomcat7 war.

          People

          • Assignee:
            Mark Collette
            Reporter:
            Patrick Guerin
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: