I am trying to create some sort of dynamic table with different rows and columns. Each cell in the table should contain one checkbox each.
Here's my action form. intColumnCount represents number of columns. intRowCount represents number of rows.
in my JSP i need to display them so I use logic iterate.
But I am getting error Cannot create iterator for this collection. I am thinking its because, I cant iterate on non-collection object (intColumnCount and intRowCount). I need those two variable so I could generate my <tr></tr> and <td></td> html tags.
Is there a way I can iterate on non-collection object without using scripting? I hope I had explained things clearly. Thanks.
Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Joined: Jul 09, 2007
I found my answer to my question but I had to resort to using scripting in my JSP wherein I need to display something like this.
wherein each element represents 1 checkbox. Some sort of a minesweeper game on the web.
I cant find any ways on how to implement this using struts tag alone only. My JSP looks bad with scripting on it and I cant generate a closing </tr> tag for my JSP also. But either way, my browser interpreted it as is and displayed it correctly.
Hope someone has better idea on how to implement this because I'm trying to avoid scripting in my JSP. But on my own, I think scripting still comes handy in some rare cases, am i right in this? Thanks.
Another option would be to transform your data into a two dimensional array in your action class and then use nested iterate tags. I am not sure this would be a "better" solution but it would get rid of the scriptlet code.