Results 1 to 5 of 5

Thread: Auto-magic binding of request params to flow input

  1. #1
    Join Date
    Jun 2008
    Posts
    16

    Default 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 at 12:21 PM. Reason: un-fixed earlier code sample. type was correct

  2. #2
    Join Date
    Jan 2011
    Location
    Kirovohrad, Ukraine
    Posts
    59

    Default

    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" />

  3. #3
    Join Date
    Jun 2008
    Posts
    16

    Default

    Quote 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

  4. #4
    Join Date
    Jun 2008
    Posts
    16

    Default

    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!

  5. #5

    Default

    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

Posting Permissions

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