I want to use the FlowExecutuinExceptionHandler to handle all business exceptions and only to show message on the current view. The problem is when the exception is thrown from for example an action state. How can I redirect to the last view state?
I want to use the FlowExecutuinExceptionHandler to handle all business exceptions and only to show message on the current view. The problem is when the exception is thrown from for example an action state. How can I redirect to the last view state?
If you know its id (You stored it in a variable somewhere), you can do this:Code:context.execute(new Transition(new DefaultTargetStateResolver(originatingViewStateId)));
Well, webflow had support for this till the 2.0.5 version. It was removed in the 2.0.6.
The ViewState class would store "webflow.originatingViewState" in the requestScope when it was exited.
So, you could store the id you want yourself with something like this:
But is not generic, as you requested.Code:<view-state id="someId"> <on-entry> <set name="requestScope.originatingViewStateId" value="someId" /> </on-entry> </view-state>
They are planning to add a global 'back' transition for the 3.0.0M1 version, and maybe you can find some good ideas in the feature requests or the posts referenced in it.
This solution is great, but what if you only want to render a fragment rather than refresh the entire screen? Is it possible or is the approach Jeremy suggested the only one capable of leaving the flow in a consistent state?
Thanks!
I guess it's possible to do it.
To render only fragments you have to use a transition in your flow definition, after all. So there must be some way to create a transition that will only render the fragments specified.
You should put a breakpoint in the Transition class and debug a transition defined with render fragments to see what's going on and try to reproduce it.
You should have a look at org.springframework.webflow.engine.builder.model.F lowModelFlowBuilder.parseTransition(TransitionMode l transition). It doesn't look like and easy task though.
Maybe it is, but you'll have to go through a lot of parseXXXX methods to find what you need.
Last edited by triqui; Aug 12th, 2010 at 03:51 AM.
Thanks, but I've decided to stay with the approach of refreshing the screen. This way I can leverage the h:messages tag that is already on the string and I avoid having to code a transition in all my flows to handle my use case.