You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2006/06/10 05:17:20 UTC

[jira] Updated: (WW-1189) form field tags should be able to depend on iterator tags to write their names out as indexed w/special attribute

     [ http://issues.apache.org/struts/browse/WW-1189?page=all ]

Don Brown updated WW-1189:
--------------------------

    Fix Version: Future
                     (was: 2.0.0)

> form field tags should be able to depend on iterator tags to write their names out as indexed w/special attribute
> -----------------------------------------------------------------------------------------------------------------
>
>          Key: WW-1189
>          URL: http://issues.apache.org/struts/browse/WW-1189
>      Project: Struts Action 2
>         Type: Improvement

>     Versions: WW 2.2.1
>     Reporter: Gabriel Zimmerman
>      Fix For: Future

>
> It would be nice for input fields to be able to, if an attribute such as indexed="true" is set to depend on an iterator. So for example:
> <ww:iterator value="fruits">
>      <ww:text name="name" indexed="true"/><br>
>      <ww:text name="color" indexed="true"/><br>
> </ww:iterator>
> would generate if KeyProperty were specified (in this example as the name property):
>      <input type="text" name="fruits('orange').name" value="orange">
>      <input type="text" name="fruits('orange').color" value="orange">
>      <input type="text" name="fruits('apple').name" value="apple">
>      <input type="text" name="fruits('apple').color" value="red">
>      <input type="text" name="fruits('banana').name" value="banana"> 
>      <input type="text" name="fruits('banana'').color" value="yellow">
> etc.
> Or in the case of a List where KeyProperty is not specified:
>      <input type="text" name="fruits[0].name" value="orange">
>      <input type="text" name="fruits[0].color" value="orange">
>      <input type="text" name="fruits[1].name" value="apple">
>      <input type="text" name="fruits[1].color" value="red">
>      <input type="text" name="fruits[2].name" value="banana"> 
>      <input type="text" name="fruits[2].color" value="yellow">
> etc.
> Something also that might be helpful is to be able to add a prefix to the name, if fruits, say were a subproperty of the submitting action, so in the first example:
> <ww:iterator value="fruits">
>      <ww:text name="name" indexed="true" prefix="fruitbowl."/><br>
>      <ww:text name="color" indexed="true" prefix="fruitbowl."/><br>
> </ww:iterator>
> Would generate:
>      <input type="text" name="fruitbowl.fruits('orange').name" value="orange">
>      <input type="text" name="fruitbowl.fruits('orange').color" value="orange">
>      <input type="text" name="fruitbowl.fruits('apple').name" value="apple">
>      <input type="text" name="fruitbowl.fruits('apple').color" value="red">
>      <input type="text" name="fruitbowl.fruits('banana').name" value="banana"> 
>      <input type="text" name="fruitbowl.fruits('banana'').color" value="yellow">
> Now comes the hard question. What would be the ideal way to deal with nested iterators? The way I have thought of is to use another attribute called nested, which if set to true would index all previous loops. So, if we have:
> <ww:iterator value="fruitbowls">
> <ww:iterator value="fruits">
>      <ww:text name="name" indexed="true" prefix="fruitbowl."/><br>
>      <ww:text name="color" indexed="true" prefix="fruitbowl."/><br>
> </ww:iterator>
> </ww:iterator>
> It would generate:
>      <input type="text" name="fruitbowls[0].fruits('orange').name" value="orange">
>      <input type="text" name="fruitbowls[0].fruits('orange').color" value="orange">
>      <input type="text" name="fruitbowls[0].fruits('apple').name" value="apple">
>      <input type="text" name="fruitbowls[0].fruits('apple').color" value="red">
>      <input type="text" name="fruitbowls[0].fruits('banana').name" value="banana"> 
>      <input type="text" name="fruitbowls[0].fruits('banana'').color" value="yellow">
>      <input type="text" name="fruitbowls[1].fruits('orange').name" value="orange">
>      <input type="text" name="fruitbowls[1.fruits('orange').color" value="orange">
>      <input type="text" name="fruitbowls[1].fruits('apple').name" value="apple">
>      <input type="text" name="fruitbowls[1].fruits('apple').color" value="red">
>      <input type="text" name="fruitbowls[1].fruits('banana').name" value="banana"> 
>      <input type="text" name="fruitbowls[1].fruits('banana').color" value="yellow">
> Comments? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira