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

        There are no subversion log entries for this issue yet.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: