I'm having trouble with the following scenario. I generate a table with a column in which i place a checkbox per row. The number of checkboxes created depends on the size of a collection. Something similar to the gmail inbox folder. I want to be able to select one or more of these checkboxes to perform some action over the objects they represent (remove them in my case)
If i use checkboxlist tag in my jsp page, (lets say i have 10 objects in the collection) it displays the 10 checkboxes toguether, and not one in each row (dont know how to format that)
So i decided to try the checkbox tag, but i cant get the values in my action class.
In my class action i have a variable StringselectedOperations with setter and getter... but when i see what gets inside i have only the position  with a String like this: "true, true, true" depending on how many checkboxes were checked. The thing is that i cant distinguis which true corresponds with which checkbox since empty checkboxes dont include "false" to that String.
Can anybody give a hand and tell me what do i do wrong? In case it was not obvious yet, i am new in Struts 2, and dont know Struts, so please be patient
I believe I had the same problem you are have yesterday. I was able to get it to work by doing the following:
I wish I had an explanation for why this worked for me but I don't have a good understanding of what the process is that struts2 uses to populate arrays and ArrayLists from html forms. If anyone know a good place that describes this process, please let me know.
Joined: Sep 03, 2008
Thanks for your reply, in fact i'm a step closer to get it thanks to your post, but unfortunatelly it's still not working completelly fine for me. With your code i can get my variable operationsSelected in my action class created with the proper size, but the values inside are null. If my collection is size=5, never mind how many checkboxes i select, my array String operationsSelected will be created size=5, but with null inside each position...
I'm still testing so if i can find out something, i'll post it here
Joined: Sep 03, 2008
At the end i substituted the checkboxes with links "Remove" Its a pity that i couldnt understand how to solve that, but it was getting too much time consuming