Results 1 to 6 of 6

Thread: Current State Id

  1. #1
    Join Date
    Mar 2006
    Posts
    29

    Default Current State Id

    Hi,
    I am new to Spring Webflow. I recently started looking into M4. I want to know how I can find the current state id in a Java method which in invoked in "evaluate" element.
    Thanks,
    Basheer.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    If you need to access flow context like the current state from Java, it's usually best to implement and invoke a custom Action. See the Action interface. To invoke an action, simply use the evaluate tag like <evaluate expression="myAction"/>

    Alternatively, you could always pass such context into the method you are evaluating.

    Lastly, you can use the RequestContextHolder to look up flow context using a thread local.

    Keith
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Mar 2006
    Posts
    29

    Default

    Hi Keith,
    Thanks for the reply. Won't it be a good idea to make RequestContext available in the flowScope, so that it can be injected into any Java class, not just the ones that implement the Action interface?
    Thanks,
    Basheer.

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    You can inject requestContext by referring to the variable "flowRequestContext" in your flow EL.

    Keith
    Keith Donald
    Core Spring Development Team

  5. #5
    Join Date
    Mar 2006
    Posts
    29

    Default

    Wonderful. That is what I am looking for. Where do I find all such implicit variable names (like flowScope, flowRequestContext ect.)?
    Thanks,
    Basheer.

  6. #6
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Look at ImplicitFlowVariableResolver for EL and WebFlowOgnlExpressionParser for OGNL.

    Keith
    Keith Donald
    Core Spring Development Team

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •