Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1498

Spring MVC @Controller Should Be Able to Access FlowScoped Data

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:

      Description

      Currently Webflow is very transition oriented, which is understandable given a definition of a "flow". However, some flow states require a higher level of interaction without needing to transition: e.g. AJAX request/response on user input / time outs / events / etc..

      AJAX requests are easy => fire up a JQuery.ajax.. and the request is sent.

      Responses are quite hard with the current state of the Webflow.

      In general, since a Webflow is not well interaction oriented, a simple @Controller can accept such JQuery AJAX request, and serve up those JSON responses [ going out of the Webflow state machine ].

      BUT.. in most cases a flowScope would contain lots of useful data, possibly even from previous steps, which the server would need in order to create that intelligent response.

      PROBLEM:

      Currently there is no Webflow'ish / Spring MVC'ish way to access that "flowScoped" data in a @Conroller

      Alternative solutions maybe used: keep/duplicate all this data in cache that can be accessed by the server and the client; send all 150 fields back to the server in that JQuery AJAX request, etc.. => not clean at all.

      WHAT PEOPLE WANT:

      Would be very useful and clean to have something like [notice the "@Flow"]:

      @RequestMapping("/data/availableProducts")
      public @ResponseBody List getProducts(@Flow Account account, @RequestParam("query") String query) {
          List<Product> products = // filter using a query and data from the account being created
          return products;
      }
      

      here is the supporting resource: http://ytoh.wordpress.com/2011/09/07/flow-accessing-webflow-data-in-spring-mvc-controllers/

      Other annotations / ideas are also welcome. Let's make AJAX responses simple in Spring Webflow => there is no reason for it not to be simple.

        Attachments

          Activity

            People

            Assignee:
            kdonald Keith Donald
            Reporter:
            litius Anatoly Polinsky
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - 2d
                2d
                Remaining:
                Remaining Estimate - 2d
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified