Back Forum Reply New

Accessing the result in different/all states

Hi All,

I have a simple doubt here.Please clarify

I have an application for which am using webflow. In this, on entering the view state, the view is then rendered. On transition, I perform an action which is performed in the action-state, the result is stored in the method-result after which and i go back to the same view-state that called the action-state. Here I want the method-result to be available in the view-state which i got in the action-state.

Please give suggestions to do this.

Thanks,
Deep

No answers yet,
Hi Keith,Erwin...
give some suggestions
Let me make my question more clear !

The flow goes like, I start from the lt;view-state id=quot;viewPage1quot; view=quot;page1quot;gt; which calls the lt;action-stategt; where i perform an action. On success it transitions back  to page1 lt;transition on=quot;successquot; to=quot;viewPage1quot; /gt; . How do I get my result loaded/variable in with the viewPage1 after performing the action.

please give suggestions.

Deep

PS: On performing the action in the view state itself i get the result which i store it in the method result, but i don't want it this way. How do I make the variable globally available

Try

Code:
lt;action-state id=quot;quot; gt;  lt;evaluate expression=quot;your actionquot; result=quot;flowScope.variablequot;/gt;
lt;/action-stategt;You have a number of options, depending on what you mean by globally available of-course. It also depends on what you are using the variable (to be exposed in the view) for.

For example, after the action-state if the data is only quot;once off' then it probably belongs in flashScope - meaning that the logic referencing this information should probably go in render-actions.

Alternatively if the data is referenced multiple times (not once-off) then it makes sense putting the logic in the action-state, in this case my preference is to put the data on the command of the formAction, a also like to use composite command object, in this situation i use the formAction to embed the logic as opposed to the flow.Code:
Event doSomeAction(RequestContext context) {
       context.getFlowScope().put(name, value);      //or      context.getConversationScope().put(name, value);      return result(someId);
}

Anyhow, you get the drift.

Yeah, that drifts the flow and it works fine

Thanks,
DeepEdward
¥
Back Forum Reply New