Announcement Announcement Module
Collapse
No announcement yet.
[Web Flow] OGNL Expression to get parameters? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [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
    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.

    Comment

    Working...
    X