Results 1 to 6 of 6

Thread: variable on-exception handling

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    brussels
    Posts
    7

    Post variable on-exception handling

    Hello,

    If an error occurs I want to go back to the screen I came from and display the error on it in a special format.
    transforming error into usable beans works. (done in a listener exceptionThrown method)
    putting the state to go to in requestScope also works (done also in a listener).

    redirecting to this scope does not work. webflow won't resolve the ${...} in the to of the transition. The error states that state ${...} is not found in the list of possible states.

    the system of using ${...} in to works for a normal transition.

    Is there something I'm missing?

    <global-transitions>
    <!-- this works -->
    <transition on="reload" to="${flashScope.reloadTo}" />
    <!-- this does not -->
    <transition on-exception="java.lang.Exception" to="${requestScope.reloadTo}" />
    </global-transitions>

    hans

  2. #2
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    It seems on-exception does not resolve transitions dynamically. You could go to an action state (e.g. "backToLastViewState") and transition from it to the last view state. It sounds you've a listener to keep track of the last view state. If not check this:
    http://opensource.atlassian.com/proj...browse/SWF-238

  3. #3
    Join Date
    Jan 2007
    Location
    brussels
    Posts
    7

    Default

    Thank you,

    I applied following sollution:

    * I used the listener you said (already had it for other reasons) http://opensource.atlassian.com/proj...browse/SWF-238

    * added the following to global-transitions
    Code:
    <transition on-exception="java.lang.Exception" to="backToLastViewState" />
    * added following state to the flow
    Code:
    <decision-state id="backToLastViewState">
        <if test="${flowScope.previousViewStateId == null}" then="defaultState"
                else="${flowScope.previousViewStateId}" />
    </decision-state>
    Where 'defaultState' is the state to go to when an error occurred before the first view state is shown.

    I think this is a quite proper solution to redirect a user to the screen he came of when an error occurres.

    hans

  4. #4
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    It seems on-exception does not resolve transitions dynamically.
    That's an oversight. I've created a JIRA issue:
    http://opensource.atlassian.com/proj...browse/SWF-269

    Erwin

  5. #5
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    This was indeed an issue. It's fixed now and will be released with SWF 1.0.2.

    Erwin

  6. #6

    Default

    Thank for fixing this issue! Need an update soon.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •