You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bradharris <bm...@gmail.com> on 2008/01/30 00:17:51 UTC

Re: [S2] Iterator and Index

Any Response to this question?  I'm really hoping this wasn't left out of
Struts2, but I can't seem to find anything indicating there is support for
iterative form fields.  This is a pretty big piece to be missing, so
feedback on the correct approach here would be appreciated.

-- 
View this message in context: http://www.nabble.com/-S2--Iterator-and-Index-tp9946320p15171908.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Iterator and Index

Posted by Laurie Harper <la...@holoweb.net>.
Dave Newton wrote:
> --- bradharris <bm...@gmail.com> wrote:
>> Any Response to this question?  I'm really hoping this wasn't left out of
>> Struts2, but I can't seem to find anything indicating there is support for
>> iterative form fields.  This is a pretty big piece to be missing, so
>> feedback on the correct approach here would be appreciated.
> 
> There is [currently] no automagic support for indexed form fields.
> Constructing the names, however, is pretty straight-forward. It's not really
> that "big of a piece" IMO, but it is a minor irritation. File a JIRA if
> you're concerned (I don't know if there is one already).

To be clear, the part that is missing is automatically generating the 
names of the input fields appropriately. You can certainly still use 
collection-backed form fields, you just need a little extra coding in 
your JSP. Something like this:

     <s:textfield id="name[%{#stat.index}]" name="firstname" label="...">

or

     <s:textfield name="names[%{#stat.index}].firstname" label="...">

(I'm not sure off the top of my head which is right, but it'll be 
something along those lines...)

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Iterator and Index

Posted by Dave Newton <ne...@yahoo.com>.
--- bradharris <bm...@gmail.com> wrote:
> Any Response to this question?  I'm really hoping this wasn't left out of
> Struts2, but I can't seem to find anything indicating there is support for
> iterative form fields.  This is a pretty big piece to be missing, so
> feedback on the correct approach here would be appreciated.

There is [currently] no automagic support for indexed form fields.
Constructing the names, however, is pretty straight-forward. It's not really
that "big of a piece" IMO, but it is a minor irritation. File a JIRA if
you're concerned (I don't know if there is one already).

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org