11 Replies Latest reply: Nov 20, 2003 6:36 PM by steve.west RSS

    Multi page BC4J data entry and stateful mode

    steve.west
      I've been trying to set up a multi-page UIXML BC4J data entry process using a train, a navigationBar and a "stateful" BC4J VO. There is precious little documentation and no examples that I can find, and I cannot get it to work. What I want is for the user step through multiple UIX pages to create a record with many attributes, displaying some on each page. According to the documentation, setting the rootAppModule release mode to stateful should automate this process.

      For testing, I have created two UIX pages which create the same View Object and display the same attributes. However, when I navigate between the pages, any data entered is lost. I would have expected to see data entered in previous steps for the same attribute - am I missing the point? How is the "stateful" scenario supposed to work?


      Thanks,


      Steve
        • 1. Re: Multi page BC4J data entry and stateful mode
          307050
          Steve,

          I'll try to look into this question and post a reply soon, but quickly: What JDev version are you using? Right now with multiple versions out there it's important for us to know which one you are interested in (9.0.3.? or 9.0.5.0).

          Thanks,
          Brian
          UIX Team
          • 3. Re: Multi page BC4J data entry and stateful mode
            307050
            Steve,

            When you navigate between pages, are you actually capturing the new values and setting them to BC4J in your event handler before navigating? With the UIX/BC4J tags in 9.0.3/9.0.4, your handler is responsible for posting back user values to BC4J. (This is simplified when using the new ADF model integration in 9.0.5.)

            If you are doing so, can you post what your event handler looks like for handling navigation from the first to the second page?

            Thanks,
            -brian
            UIX Team
            • 4. Re: Multi page BC4J data entry and stateful mode
              steve.west
              Steve,

              When you navigate between pages, are you actually
              capturing the new values and setting them to BC4J in
              your event handler before navigating? With the
              UIX/BC4J tags in 9.0.3/9.0.4, your handler is
              responsible for posting back user values to BC4J.
              (This is simplified when using the new ADF model
              integration in 9.0.5.)
              No, how do I actually do this?

              >
              If you are doing so, can you post what your event
              handler looks like for handling navigation from the
              first to the second page?
              My event handler in train0.uix is tres simple:


              <event name="goto">
              <ctrl:go name="train1" redirect="true"/>
              </event>


              My train1.uix file has excatly the same BC4J VO's as train0.uix.
              Thanks,
              -brian
              UIX Team
              Steve
              • 5. Re: Multi page BC4J data entry and stateful mode
                steve.west
                Hi,
                I have looked at how the ToyStore demo does this with Struts and BC4J - it uses transient attributes for the Shopping Cart entity, but the problem is that I don't know how to translate this technique into UIX/BC4J, or whether it is the best way of doing it.


                Steve
                • 6. Re: Multi page BC4J data entry and stateful mode
                  307050
                  Steve,

                  The idea is the same using UIX/BC4J, but with the bindings in 9.0.3 the page developer is responsible for posting back values changed by the user on every navigation. So to go from Step 1 to Step 2 in a wizard, you need to:

                  1) Fire an event on the current page in such a way that it submits the form. The various UIX components that can fire events all have a way to make it use form submission.

                  2) In your event handler, grab values from the event parameters and save them to your row. You do this the same way you post back values in any handler using the UIX/BC4J integration. This involves having bc4j:findRootAppModule, bc4j:findViewObject, bc4j:findRow, etc, then using bc4j:setAttribute (or bc4j:setRegion) to post values back to the row.

                  3) At the end of the handler, do a <go> to go to the next page. Due to the statefulness of the application module, when you get to the next page you'll be on the same row, and the values are captured in the back end.

                  Hope this helps,
                  -brian
                  UIX Team
                  • 7. Re: Multi page BC4J data entry and stateful mode
                    steve.west
                    Hi Brian,
                    Thanks for the help, I understand how this is supposed to work now. I have tried this out but it still does not seem to work. I am saving the values in my goto event before calling the next page as follows:

                    <event name="goto">
                    <bc4j:findRootAppModule name="BudModule">
                    <bc4j:findViewObject name="BudgetVO1">
                    <bc4j:findRow name="createBud">
                    <bc4j:setPageProperty name="key">
                    <bc4j:stringKey/>
                    </bc4j:setPageProperty>
                    <!-- set two attributes explicitly -->
                    <bc4j:setAttribute name="BudgetId"/>
                    <bc4j:setAttribute name="BudgetName"/>
                    <ctrl:go name="train1" redirect="true"/>
                    </bc4j:findRow>
                    </bc4j:findViewObject>
                    </bc4j:findRootAppModule>
                    </event>

                    However, these values do not seem to be retained in my BC4J row when I call my next page (train1). Is there anything special I need to do in train1.uix?

                    Steve
                    • 8. Re: Multi page BC4J data entry and stateful mode
                      307050
                      Steve,

                      I think I see the problem. In your first page of the wizard, you need to have a <bc4j:insertRow> just before the <go>. The reason is that a new row was implicitly created by BC4J, but it has not yet been set back to the view object. By calling <bc4j:insertRow>, the new row is stored back to the VO (but not to the database until commit, which presumably would be on the finish page of the wizard).

                      I hope this help!
                      -brian
                      UIX Team
                      • 9. Re: Multi page BC4J data entry and stateful mode
                        steve.west
                        Hi Brian,
                        I've now put the <bc4j:insertRow> tag just before my go, but I now have two problems:
                        First, if I don't include all of my required attributes for the row on the first page, <insertRow> will validate this and error out. How do I get around this?

                        Second, I have done a test where I capture all of my attributes on the first page, then insertRow and navigate to the second page. It fails after showing the second page with "oracle.jbo.AttrValException: JBO-27014: Attribute ManagerId in ItiBudgets is required" even though I am including it on both pages, and populating it on the first page.

                        Thanks,

                        Steve
                        • 10. Re: Multi page BC4J data entry and stateful mode
                          steve.west
                          REPOSt - does anyone have any ideas on this? Am I the only person trying to do this?


                          Steve