Results 1 to 2 of 2

Thread: [Web Flow] OGNL Expression to get parameters?

  1. #1
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default [Web Flow] OGNL Expression to get parameters?

    Is it possible to use something like the following, except check to see if a certain request parameter was passed in?

    Code:
    <transition on="$&#123;#result == 'success' and param.prev != null&#125;" to="nameForm"/>
    I'd like to be able to use the same bindAndValidate action-state to handle next and previous buttons in a wizard. However, I want to change the transition to be a different form based on whether next or previous was clicked.

    Thanks,

    Matt

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

    Default

    Matt,

    You can certainly test against arbitrary attributes in requestScope or flowScope, for example:

    Request Scope:

    Code:
    <transition on="$&#123;#result == 'success' and requestScope.prev != null&#125;" to="nameForm"/>
    Flow Scope:

    Code:
    <transition on="$&#123;#result == 'success' and flowScope.prev != null&#125;" to="nameForm"/>
    However, neither of those will work for the originating http request's parameters, as those parameters are associated with the originating Event of the current flow RequestContext.

    One option is to have a mapper action that maps a 'on submit' event parameter to a request-scope attribute. That's pretty easy using a EventParameterMapperAction--Phonebook does this already.

    However, that seems a bit clunky here. There is a better solution that should work. As I mentioned, the RequestContext (what the OgnlTransitionCriteria has access to) exposes a property called "originatingEvent". This, in a HttpServlet environment, is a HttpServletEvent that wraps the current HttpServletRequest. So, through it, you should be able to access any request parameter.

    Give this a try:

    Code:
    <transition on="$&#123;#result == 'success' and originatingEvent.parameters.prev != null&#125;" to="nameForm"/>
    We might in the future consider having Event implement Map, similiar to what Scope does now, so parameters can be accessed directly (e.g originatingEvent.prev). But the notation above is pretty good I think.
    Keith Donald
    Core Spring Development Team

Similar Threads

  1. Replies: 3
    Last Post: Aug 9th, 2005, 04:01 AM
  2. Spring + Hibernate ORA-00936: missing expression
    By Hugh_la_Main in forum Data
    Replies: 1
    Last Post: Jun 28th, 2005, 08:48 AM

Posting Permissions

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