ICEfaces
  1. ICEfaces
  2. ICE-8225

ace:fileEntry - upload listener is not called when commandButton returns an action

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1, EE-3.0.0.GA, 3.1.0.BETA1
    • Fix Version/s: 3.1.0.RC1, 3.1, EE-3.0.0.GA_P01
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All
    • Assignee Priority:
      P1

      Description

      If a commandButton returns navigation, the fileEntry listener will not run. In our testing, if the commandButton that submits the form containing a fileEntry returns a navigation case or navigation string, the fileEntry listener doesn't run at all. Since the listener also can't return a navigation case, the only way we have of routing the user to a different view after uploading a file is by doing a hard redirect inside of the listener. For optional files, we also have to dual-develop the navigation - once in a button that doesn't have the file and returns a navigation, the second time inside the listener.

      Please see attached fileUploadProblem2.xhtml for a demonstration. The first submit button is not wired to an action. The second is wired to an action that returns null. Both work. The third is wired to an action that returns navigation. It fails. You can see in console that the UploadBean's "Set a file" output is never produced.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows issue. Run fileUploadProblem2.jsf to see issue.

        Show
        Arran Mccullough added a comment - Attached test case that shows issue. Run fileUploadProblem2.jsf to see issue.
        Hide
        Mark Collette added a comment -

        From FileEntryMeta:

        @Property(tlddoc="When true, the fileEntryListener will be invoked at " +
        "the end of the APPLY_REQUEST_VALUES phase. Otherwise, it will be " +
        "invoked just before rendering, so that the application will " +
        "receive the event, regardless of whether the form has passed " +
        "validation or not.",
        defaultValue="false")
        private boolean immediate;

        The default is for the fileEntryListener to be invoked at the beginning of RENDER_RESPONSE, which won't happen if the view has navigated away to another. So try setting immediate="true" on the fileEntryListener, when using navigation. If that phase is not convenient, then try setting immediate="true" as well as using ice:setEventPhase, but I'm not sure if you can use INVOKE_APPLICATION, since it will still navigate away and I'm not sure if the FileEntryEvent will be handled first.

        Show
        Mark Collette added a comment - From FileEntryMeta: @Property(tlddoc="When true, the fileEntryListener will be invoked at " + "the end of the APPLY_REQUEST_VALUES phase. Otherwise, it will be " + "invoked just before rendering, so that the application will " + "receive the event, regardless of whether the form has passed " + "validation or not.", defaultValue="false") private boolean immediate; The default is for the fileEntryListener to be invoked at the beginning of RENDER_RESPONSE, which won't happen if the view has navigated away to another. So try setting immediate="true" on the fileEntryListener, when using navigation. If that phase is not convenient, then try setting immediate="true" as well as using ice:setEventPhase, but I'm not sure if you can use INVOKE_APPLICATION, since it will still navigate away and I'm not sure if the FileEntryEvent will be handled first.
        Hide
        Mark Collette added a comment -

        Added the ability for the fileEntryListener to return an outcome that, if non-null, will be used for navigation. Tested with immediate set to true and false, and navigation works. Old bean methods that have a void return type are fine, they just don't trigger navigation. Updated the FileEntryMeta @Property docs to explain it all.

        icefaces3 trunk
        Subversion 29780

        Show
        Mark Collette added a comment - Added the ability for the fileEntryListener to return an outcome that, if non-null, will be used for navigation. Tested with immediate set to true and false, and navigation works. Old bean methods that have a void return type are fine, they just don't trigger navigation. Updated the FileEntryMeta @Property docs to explain it all. icefaces3 trunk Subversion 29780
        Hide
        Mark Collette added a comment -

        Ported to the maintenance branch.

        icefaces3-maintenance branch
        Subversion 29798

        Show
        Mark Collette added a comment - Ported to the maintenance branch. icefaces3-maintenance branch Subversion 29798
        Hide
        Mark Collette added a comment -

        For testing:

        Have a bean fileEntryListener of return type void. Set immediate to true and false for uploads and make sure that still works, as before.

        Have a fileEntryListener of return type String and return null, "", and a valid navigation outcome. Test with immediate set to tr and false for each of those.

        Show
        Mark Collette added a comment - For testing: Have a bean fileEntryListener of return type void. Set immediate to true and false for uploads and make sure that still works, as before. Have a fileEntryListener of return type String and return null, "", and a valid navigation outcome. Test with immediate set to tr and false for each of those.

          People

          • Assignee:
            Mark Collette
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: