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

Cannot dynamically choose a list of fragments to render using <render fragments="..."/>

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.8
    • Fix Version/s: None
    • Component/s: Core: Flow Executor
    • Labels:
      None

      Description

      Case 1) This works:
      <render fragments="${requestScope.wasSpnNew ? 'cpartySweSettings' : 'cpartyDefSettings'}"/>
      epending on the value of requestScope.wasSpnNew is rendering correctly either "cpartySweSettings" or "cpartyDefSettings" fragment.

      Case 2) This does not work:
      <render fragments="${requestScope.wasSpnNew ? 'cpartyDefSettings,cpartySweSettings,cpartyWritingConvs,cpartyInternalContacts' : 'cpartyDefSettings'}"/>
      in this case it tries to render a fragment 'cpartyDefSettings,cpartySweSettings,cpartyWritingConvs,cpartyInternalContacts'

      After debugging, I saw that the problem lies in the following piece of code:

      package org.springframework.webflow.action
      ...
      public class RenderAction extends AbstractAction {
      ...
      protected Event doExecute(RequestContext context) throws Exception {
      String[] fragments = new String[fragmentExpressions.length];
      for (int i = 0; i < fragmentExpressions.length; i++)

      { Expression exp = fragmentExpressions[i]; fragments[i] = (String) exp.getValue(context); }

      context.getFlashScope().put(View.RENDER_FRAGMENTS_ATTRIBUTE, fragments);
      return success();
      }
      ...
      }

      For both cases fragmentExpressions contains a single expression. For case 2) and requestScope.wasSpnNew == true, the expression gets correctly evaluated to the string "cpartyDefSettings,cpartySweSettings,cpartyWritingConvs,cpartyInternalContacts", but this string is just set as fragments[0], instead of being parsed as a comma separated list of fragments, so we end up with fragments array containing a single entry (

      { "cpartyDefSettings,cpartySweSettings,cpartyWritingConvs,cpartyInternalContacts" }

      ) instead of containing 4 entries (

      { "cpartyDefSettings","cpartySweSettings","cpartyWritingConvs","cpartyInternalContacts" }

      ) and of course afterwards Tiles is not finding a fragment "cpartyDefSettings,cpartySweSettings,cpartyWritingConvs,cpartyInternalContacts".

        Attachments

          Activity

            People

            Assignee:
            kdonald Keith Donald
            Reporter:
            vbrasov valentin brasov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: