This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi All.. I am new to struts and having a problem with IndexId attribute of iterate.. I have to edit the marks of courses of some students.. so first i have to display the marks and courses and then submit new marks..
You have some mistakes in your JSP. Let's just explain the logic:iterate first. First of all, the id attribute is a name given to the current element of the collection you are iterating on. This means that if you are iterating on a collection named collection and you put the value of the id attribute as element, then at the first iteration, element will have the value of collection, and so on.
The indexId attribute is just a name of a variable that will act as a counter variable so that you can use it in your JSP for several reasons (for example if you are displaying results in rows, you can give a style to even rows, and another to odd ones), but not to get the element from the collection, since it's already there.
Now, your collection is in the action form, and that's a little tricky. Here, the name attribute should be the name of your form (I guess as defined in the struts config file), and the property attribute should be the name of the collection property in that form. I usually prefer putting my collections in a request attribute rather than in the form class.
I hope this helps. Please try and tell me the result