Announcement Announcement Module
Collapse
No announcement yet.
Accessing the result in different/all states Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    No answers yet,
    Hi Keith,Erwin...
    give some suggestions

    Let me make my question more clear !

    The flow goes like, I start from the <view-state id="viewPage1" view="page1"> which calls the <action-state> where i perform an action. On success it transitions back to page1 <transition on="success" to="viewPage1" /> . 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

    Comment


    • #3
      Try
      Code:
      <action-state id="" >
         <evaluate expression="your action" result="flowScope.variable"/>
      </action-state>

      Comment


      • #4
        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 "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.

        Comment


        • #5
          Yeah, that drifts the flow and it works fine

          Thanks,
          DeepEdward

          Comment

          Working...
          X