I think you need to post your code properly. The code that you gave won't compile as groupB is not declared when it is used in groupA. Also you can't fit a String[] into a String[]. You need to have a 2-d String array. Are you trying to say that you want to iterate over a 2 dimensional array like this
If yes, then I think you can easily do this in Struts 2 (I don't know about struts 1 and you have also not mentioned which version of struts you are using)...
Thank you Ankit Garg. sorry i did not explain clearly, i am using struts 1.2.9. I have a ActionForm like the following:
In JSP file, there is dropdown list which contains all group names and shows the first one. Now I want to add a table to display the student names in a group when user select a group
from a dropdown list. And user may move students to other table, then I need update the table in form and forward to Action. Could I use Struts <html:iterate> to do this? I know how to use <html:iterate> to display like uid, name, but do not know how to display students array.
For example, if I have 3 group A,B,C, how could I diplay student names in group B using html:iterate ?
It's <logic:iterate>, not <html:iterate>. I'm not sure what the confusion is--the iterate tag docs describe it pretty well.
That said, using JSTL may be a better solution--it's recommended that when JSTL and Struts tag functionality overlap that JSTL is used. The Struts tags were written before JSTL existed.
Lei Guoguo
Greenhorn
Joined: Mar 31, 2009
Posts: 26
posted
0
if you can use jstl tag, you can write like under code
I'm a chinese, my english is so bad, I need help. If you want to help me, you can send your question to my e-mail: lgg860911@yahoo.com.cn, I will help you, and improve my english. Thanks everyone.