The only syntax difference I see is you should put #stat.index rather than
stat.index so it looks like

<s:textarea name="descList[%{#stat.index}].destination"
value="%{destination}"  /&gt;


I am assuming you have the proper setter for setDescList(List<Text>
descList) in your action.

BGE Ger wrote:
> 
> Hi Laurie, thank you for help!
> 
> you are right that's what I want: to push back the updated fields into the
> list.
> And then I want access the updated fields in the update action class .
> I think maybe there is somesthing wrong in my tag syntax? I found out that
> I
> must use "{}" instead of "[]" which is only for maps, but it also doesn't
> work.
> 
> I try this example but it doesn't work:
> http://www.vitarara.org/cms/struts_2_cookbook/updating_a_list_of_domain_entities
> 
> Is there any other example anywhere, which I've not found? 
> 
> 
> I'm really desperate! What I want is not unusual, I've thought.
> This must work til tomorrow (for my company) :-((
> 
> Thank you very much for helping!
> 
> 
> 
> 
> Laurie Harper wrote:
>> 
>> I'm not sure what you mean by a 'submit in each row' but if you want to 
>> push data back into the list then yes, you need the index in the input's 
>> name as you have.
>> 
>> L.
>> 
>> BGE Ger wrote:
>>> ....thank you for the answer!  
>>> But I've read, if  I want to change the complete list with the submit
>>> action. I must use the list index.
>>> If I make a submit in each  row I can use "destination" syntax.
>>> Isn't it right? 
>>> 
>>> 
>>> Jim Kiley wrote:
>>>> For starters, you can simplify things a lot by changing your syntax
>>>> from:
>>>>
>>>> name="descList[%{stat.index}].destination"
>>>>
>>>> to just:
>>>>
>>>> name="destination"
>>>>
>>>> The iterator tag pushes descList[index] onto the OGNL stack in every
>>>> iteration, so you can refer to its attributes directly.
>>>>
>>>> jk
>>>>
>>>> On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger <[EMAIL PROTECTED]> wrote:
>>>>
>>>>> Hello,
>>>>> I'm struts(2) newbie and I need some help for the iterator tag.
>>>>> How can I access to an updated list in the action class?
>>>>> My JSP looks like:
>>>>>
>>>>> <s:form theme="simple">
>>>>>        <s:iterator   value="descList" status="stat">
>>>>>        <tr>
>>>>>        <td ><s:textarea name="descList[%{stat.index}].destination"
>>>>> value="%{destination}"  /></td>
>>>>>        <td ><s:textarea name="descList[%{stat.index}].category"
>>>>> value="%{category}"     /></td>
>>>>>        <td ><s:textarea name="descrList[%{stat.index}].source"
>>>>> value="%{source}" /></td>
>>>>>        <td><s:textarea name="descList[%{stat.index}].text"
>>>>> value="%{text}"/></td>
>>>>>        </tr>
>>>>>        </s:iterator>
>>>>>        <s:submit action="updateDescriptions" />
>>>>> </s:form>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> Action class:
>>>>>
>>>>>
>>>>> public class DescriptionTestAction extends ActionSupport {
>>>>>
>>>>>   private List<Text> descList;
>>>>>
>>>>>   public DescriptionTestAction () {
>>>>>   }
>>>>>
>>>>>
>>>>>   public void setDescList(List descList) {
>>>>>           this.descList = descList;
>>>>>   }
>>>>>
>>>>>   public List getDescList () {
>>>>>         return this.descList;
>>>>>   }
>>>>>
>>>>> --------------------------------------------------
>>>>> The descList is a spring Bean and everything works well except the
>>>>> update
>>>>> process.
>>>>> If I make an update for the destination field e.g. and then submit
>>>>> this
>>>>> form
>>>>> the descList contains the old values! I've tried everything and spend 
>>>>> lot
>>>>> of time for searching for a solution, please help!
>>>>> Thank you in advance!
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html
>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Jim Kiley
>>>> Technical Consultant | Summa
>>>> [p] 412.258.3346 [m] 412.445.1729
>>>> http://www.summa-tech.com
>>>>
>>>>
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-iterator-tag-tp18258667p18298656.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to