Announcement Announcement Module
Collapse
No announcement yet.
Auto-magic binding of request params to flow input Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto-magic binding of request params to flow input

    Hello all,
    Does anyone know if SWF will automatically bind http request params to object properties of *non primitive* flow inputs? For example, if I've defined the following flow input:
    Code:
    <input name="myInput" type="a.b.c.Foo"/>
    And foo has two String attributes attr1 and attr2. I'd like to be able to launch this flow passing in the values for attr1 and attr2 in the query string and have the "myInput" object populated with those values. I used this feature in Spring MVC but haven't found the right syntax to get SWF to bind correctly. I've tried passing the params as attr1, myInput.attr1, and foo.attr1 to no avail. Is this possible out of the box with SWF (without having to create any kind of custom converter class). I'm using SWF 2.3, Spring 3.0.5. Thanks in advance!

    Seamus
    Last edited by seamuskc; Mar 24th, 2011, 01:21 PM. Reason: un-fixed earlier code sample. type was correct

  • #2
    You could try this:
    HTML Code:
    <var name="myInput" class="a.b.c.Foo" />
    <input name="attr1" value="myInput.attr1" />
    <input name="attr2" value="myInput.attr2" />

    Comment


    • #3
      Originally posted by Madkinder View Post
      You could try this:
      HTML Code:
      <var name="myInput" class="a.b.c.Foo" />
      <input name="attr1" value="myInput.attr1" />
      <input name="attr2" value="myInput.attr2" />
      Thank you for the reply.
      I thought the value attribute of the input element was used to assign a value for the input? Will give it a shot but it seems it would just assign a value of null to both attr1 and attr2. Will report back with findings.
      Thanks

      Comment


      • #4
        Wow...looks like my understanding of the value attribute on input was completely backwards because you're suggestion did work (Thanks!) This will do the trick but I'm still curious to get an answer on if SWF can *automatically* bind request params to input object properties (without having to explicitly assign them as given in the above example). Thanks again!

        Comment


        • #5
          Well I just use the name of the <input> in the request,

          for example when I have an input
          <input name="test" required="false" />

          then I use for example:

          http://mysite/myapp?test=somevalue

          Comment

          Working...
          X