Yes, It worked. Thank you so much Nikhil.

Nikhil Walvekar wrote:
> 
> Hi Thanuja,
> 
> Can you please try using input tag (if its allowed)?
> 
> *<logic:iterate name="bookInfoForm" id="bookl" property="bookLists"
> indexId="i">
> 
> <logic:iterate id="book" name="bookl" property="books" indexId="j">
> 
> <input type="checkbox" name="bookLists[<%= i %>].books[<%= j %>].selected"
> value="true">
> 
> <bean:write name="book" property="name" />
> 
> </logic:iterate>
> 
> </logic:iterate>
> *
> I will suggest you first try it with fixed size list (both), so you can
> initialize list in form bean.
> 
> Regards,
> Nikhil
> 
> On Wed, Apr 15, 2009 at 5:07 AM, thanuja <thanuja_jayal...@yahoo.com>
> wrote:
> 
>>
>> Hi Nikhil,
>>
>> Thanks for the suggestion. I tried, but it is still not working. I am
>> using
>> struts tags and instead of <input>.
>> If my class structure was like the below one, then the values will be
>> updated without any problem when the form submitted. The problem comes
>> when
>> I have two logic iterates(as shown in my earlier post).
>>
>> class BookList
>>        String bookListName
>>        boolean selected
>>
>> class BookInfoForm extends ActionForm{
>>        ArrayList<BookList> bookLists;
>>
>>        public BookList getBookl(int index){
>>                return bookLists.get(index);
>>        }
>>        public void setBookl(int index,BookList element){
>>                bookLists.set(index, element);
>>        }
>>
>> }
>>
>> <logic:iterate name="bookInfoForm" id="bookl" property="bookLists"
>> indexId="i">
>>
>> <html:checkbox name="bookl" property="selected" indexed="true"
>> value="true"
>> />
>> <bean:write name="bookl" property="bookListName" />
>>
>> </logic:iterate>
>>
>>
>> Thanks,
>> Thanuja
>>
>>
>>
>> Nikhil Walvekar wrote:
>> >
>> > Hi Thanuja,
>> >
>> > Your checkbox tag should be rendered as
>> > <input type="checkbox" name="bookLists[i].books[j].selected"
>> value="true">
>> >
>> > I don't think logic:iterate supports property as "indexed".
>> > Probably you can create above tag using values you have.
>> >
>> > "bookLists[i].books[j].selected" will be converted as
>> > "getBookList().get(i).getBooks().get(j).setSelected(value)" you will
>> have
>> > to
>> > make sure that none of the getters return null object.
>> >
>> > Regards,
>> > Nikhil
>> > On Tue, Apr 14, 2009 at 7:04 AM, thanuja <thanuja_jayal...@yahoo.com>
>> > wrote:
>> >
>> >>
>> >> Hi,
>> >>
>> >> I am using one logic iterate tag inside another. The data set at the
>> >> inner
>> >> loop should update form bean. Following explains what i tried to do.
>> This
>> >> way the data displays as I expected. But when I select the check box
>> it
>> >> won't update the corresponding 'Book' object. (The form has list of
>> >> 'BookList' objects. Each BookList object has set of Book objects. I
>> >> wanted
>> >> to mark Book as selected.)
>> >>
>> >> class BookList
>> >>        ArrayList<Book> books
>> >>
>> >> class Book
>> >>        String name
>> >>        boolean selected
>> >>
>> >> class BookInfoForm extends ActionForm{
>> >>        ArrayList<BookList> bookLists;
>> >>
>> >>        public BookList getBookl(int index){
>> >>                return bookLists.get(index);
>> >>        }
>> >>        public void setBookl(int index,BookList element){
>> >>                bookLists.set(index, element);
>> >>        }
>> >>        public Book getBook(int index){
>> >>
>> >>                return bookLists.get(?).getBooks().get(index);
>> >>        }
>> >>        public void setBook(int index,Book element){
>> >>
>> >>                bookLists.get(?).getBooks().set(index,element);
>> >>        }
>> >>
>> >>
>> >> }
>> >>
>> >> <logic:iterate name="bookInfoForm" id="bookl" property="bookLists"
>> >> indexId="i">
>> >>
>> >> <logic:iterate id="book" name="bookl" property="books" indexId="j">
>> >> <html:checkbox name="book" property="selected" indexed="true"
>> >> value="true"
>> >> />
>> >> <bean:write name="book" property="name" />
>> >>
>> >> </logic:iterate>
>> >>
>> >> </logic:iterate>
>> >>
>> >> Thanks in advance,
>> >> Thanuja
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Multiple-Logic-iterate-tags-and-setting-indexed-properties-tp23031690p23031690.html
>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> >> For additional commands, e-mail: user-h...@struts.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Nikhil
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Multiple-Logic-iterate-tags-and-setting-indexed-properties-tp23031690p23050006.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 
> -- 
> Nikhil
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Multiple-Logic-iterate-tags-and-setting-indexed-properties-tp23031690p23083353.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to