Announcement Announcement Module
Collapse
No announcement yet.
Please Corret SCOPE? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Please Corret SCOPE?

    I have a problem with Scope. My project was working fine previously. Now I update to Web flow 1.0 and I could not get correct data from formObject.

    I have formObject1 with FLOW scope. It initializes with 3 services. After user chosen, it has 1 service. Then my last form formObject2 is Request scope. In action class I got all correct data. But last jsp page, I got 3 services instead of 1 service. Seems like it initializes again and I could not get updated data.

    Please help me how I can fix this problem.

    Thank you in advance.

  • #2
    Do a search on this forum for "alwaysRedirectOnPause". Perhaps Erwin could add this as a tip to swf tips :-)

    Keith

    Comment


    • #3
      Thank you Keith.

      I will search "alwaysRedirectOnPause".
      For now, I can fix my problem.
      Most of my action beans are defined as FLOW SCOPE and last one(summary page) is REQUEST SCOPE.
      I passed all my data with Conversation scope previously. (it was working fine in webflow 1.0 RC1). After I updated to 1.0, it does not work.

      I made it work in the following way.

      For data that I need to use in action with request scope, I passed like this now.
      context.getRequestScope().put("xxx", xxx);

      When I retrieve data, I retrieve with following:
      context.getFlowScope().get("xxx");

      It is working now. (If I get data with conversation scope, I got all initialize data and I could not get updated data).

      Thank you Keith.
      I learned a lot from web flow.

      Comment


      • #4
        As Keith mentions, search for "alwaysRedirectOnPause" on this forum and you'll find a lot of info on this subject (Yes, I'll have to write a tip about that!).

        Basically, don't use request scope, but use flash scope.

        Erwin

        Comment


        • #5
          Thank you for advice.
          Now I am using FLASH scope.
          I have a question for you.
          Now one of my action( Last Action - eg: summary) defined with the following:

          <property name="formObjectScope" value="FLASH"/>

          Before that, I want to pass value to last action. But rest of all my actions are defined with FLOW scope.
          So, I passed like this:
          context.getRequestScope().put("userDetail", userDetail);
          Then in my last action, createFormObject method, I try to get my Object.
          UserDetail ud = (UserDetail)context.getFlowScope().get("userDetail ");
          I get correct data.

          ---------------------
          However, If I passed with context.getConversationScope().put("userDetail", userDetail);
          and tried to get Object with
          UserDetail ud = (UserDetail)context.getConversationScope().get("us erDetail");

          I got NULL pointer exception. But these code used to work with webflow rc3 and I did not get errror.

          I dont understand that happened. Because I passed with request scope, but defined with flow scope. But when try to get it, only accepted Flow scope. My thinking is Conversation scope is biggest one, so if I passed with conversation scope, it should accept with conversation scope even defined with flow scope.

          Please correct what I am wrong with.

          Thanks

          Comment


          • #6
            I'm not following here:

            It works when you put something in REQUEST scope and retreive it from FLOW scope but it doesn't work when you put it in CONVERSATION SCOPE and then try to retreive it from CONVERSATION scope???

            There must be something else happening in your flow that's having an impact on this.

            My thinking is Conversation scope is biggest one, so if I passed with conversation scope, it should accept with conversation scope even defined with flow scope.
            Keep in mind that in SWF scopes don't automatically cascade to higher scopes. So you can't access an object in flow scope named "foo" by calling requestScope.get("foo"). That doesn't work. You have to explicitly use the correct scope: flowScope.get("foo").

            Erwin

            Comment


            • #7
              It works when you put something in REQUEST scope and retreive it from FLOW scope but it doesn't work when you put it in CONVERSATION SCOPE and then try to retreive it from CONVERSATION scope???
              Explanation :
              With webflow 1.0 rc3
              All actions defined in FLOW scope. Last action defined as REQUEST scope.
              In All actions submit method,
              put something in CONVERSATION scope and retrieve it from CONVERSATION scope,
              it is working.

              ********************************
              With webflow 1.0

              All actions(in bean definition) defined in FLOW scope. Last action defined as REQUEST scope.
              In All actions submit methods,
              put something in CONVERSATION scope and retrieve it from CONVERSATION scope,
              it does not work.
              Got Null point exception.
              However,
              put something in REQUEST scope and retrieve it from REQUEST scope,
              it is working.


              All codes are the same.

              That is why, I am just curious and asking you.

              Thanks.
              Last edited by klr8; Jan 18th, 2007, 12:55 AM.

              Comment


              • #8
                I'm still not exactly sure what you're trying to do here.
                What do you mean with "all actions defined in FLOW scope"? Are you talking about the formObjectScope property of the FormAction?

                Erwin

                Comment


                • #9
                  Yes. formObjectScope property of the FormAction. I defined as xx-beans.xml.

                  <bean id="xxFormAction" class="xx.xxx.XXXFormAction">
                  <property name="formObjectScope" value="FLOW"/>
                  <property name="formErrorsScope" value="FLOW"/>
                  .....
                  </bean>

                  Comment


                  • #10
                    Could you provide a bit more insight into what you are doing. Posting the relevant fragments of your web flow XML might help.

                    Erwin

                    Comment

                    Working...
                    X