I have issue with displaying a list for multiple rows. for e.g i have 10 records on a page. each record has a list box to iterate from same list in session. since the iterator id has to be different for each row, i created a on the fly id for iterator and placed liked this - where applicationStatusId is run time genearted id.
I think the problem is that you are not using the id attribute of the logic:iterate tag correctly. The id attribute does NOT accecpt scriptlets as a value so you'll need to change that to just text. I'm not sure what you're trying to achieve with using a scriptlet there. The id attribute of the iterate tag specifies the name of a page scoped variable that you can use to access the object from the that the iterator is currently operating on. You might be pretty close to having what you want if you just take out all of your scriptlet start and end tags.
Joined: Nov 14, 2008
Thanks for replying.
The problem is as there are several rows (number depends on rows returned from database) the id has to be unique for each row. If i will remove scriptlet tags then the id will be same for all rows and there it will fail. the applicationStatusId is on the fly genearted id like applicationStatus1, applicationStatus2 etc.
Is there any other way to iterate list in session several times for a select box in one page for multiple rows?
Thanks in advance.
Joined: Aug 29, 2008
The name of the object will be the same each time through the iteration, however, the value of the object will be reset each time through the loop will be updated to be a reference to the next element in the list. So if you give the id a static name (which is required) and reference that name in your bean:write tags it will write the properties of the current element in the list. This is how the id attribute is set up to be used. Is there some reason why what you are doing here is a different scenario?