Re: Multiple Logic iterate tags and setting indexed properties
Yes, It worked. Thank you so much Nikhil. Nikhil Walvekar wrote: > > Hi Thanuja, > > Can you please try using input tag (if its allowed)? > > * indexId="i"> > > > > value="true"> > > > > > > > * > 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 > wrote: > >> >> Hi Nikhil, >> >> Thanks for the suggestion. I tried, but it is still not working. I am >> using >> struts tags and instead of . >> 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 bookLists; >> >>public BookList getBookl(int index){ >>return bookLists.get(index); >>} >>public void setBookl(int index,BookList element){ >>bookLists.set(index, element); >>} >> >> } >> >> > indexId="i"> >> >> > value="true" >> /> >> >> >> >> >> >> Thanks, >> Thanuja >> >> >> >> Nikhil Walvekar wrote: >> > >> > Hi Thanuja, >> > >> > Your checkbox tag should be rendered as >> > > 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 >> > 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 books >> >> >> >> class Book >> >>String name >> >>boolean selected >> >> >> >> class BookInfoForm extends ActionForm{ >> >>ArrayList 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); >> >>} >> >> >> >> >> >> } >> >> >> >> > >> indexId="i"> >> >> >> >> >> >> > >> value="true" >> >> /> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 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
Re: Multiple Logic iterate tags and setting indexed properties
Hi Nikhil, Thanks for the suggestion. I tried, but it is still not working. I am using struts tags and instead of . 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 bookLists; public BookList getBookl(int index){ return bookLists.get(index); } public void setBookl(int index,BookList element){ bookLists.set(index, element); } } Thanks, Thanuja Thanuja Nikhil Walvekar wrote: > > Hi Thanuja, > > Your checkbox tag should be rendered as > > > 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 > 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 books >> >> class Book >>String name >>boolean selected >> >> class BookInfoForm extends ActionForm{ >>ArrayList 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); >>} >> >> >> } >> >> > indexId="i"> >> >> >> > value="true" >> /> >> >> >> >> >> >> >> 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
Multiple Logic iterate tags and setting indexed properties
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 books class Book String name boolean selected class BookInfoForm extends ActionForm{ ArrayList 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); } } 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