I have a jsp page that produces a matrix page based on database queries for both column header records and row records. The colun and row crossed fields are displayed as multiboxes, i.e., each vertical column is a multibox field named as "crossCheckBox0", "crossCheckBox1",
"crossCheckBox2", ... The number of is determined at run time database query.
If the number of fields is known design, then they can be added in to action form as String attibute, then one may take advantage of that struts would determine how many of the vertical boxes(rows) are checked at runtime.
But now the number of mutlibox fields are dynamic and runtime determined, it is an unknown dimension array like crossCheckBox[#][#]...[#] where # stands for the number of rows being same. How to represent it in action form?
May anyone have experienced this issue before and would like to shed some light on it? I would appreciate a ton for the insight.
I'm using struts 2.0, and if I had that issue, I should create a List attribute with List values.
The first level are field names, the second level are values.
And with struts 2.0 I could access by two "iterator" tags nested.
But if the issue is very difficult to be solved (each value is a selectable list), I should consider to change the GUI layout.
"Code must be easy to read" :)
The issue is that the number of multibox fields is determined at run time and it is not possible to add the attribute into actionform at design time. Each multibox is an array( or a list), but the number of these arrays or lists is unknown at design time.
As I said that I looped the conventional checkbox using JS scripting to get the matrix (or called cross tab) feature done. But actionform cannot help.
To help get the question, the matric or cross tab looks like below. The small letter "x" stands for check box.
(column: grow direction->)
r CA |x|x|x|...
o NY |x|x|x|...
w MI |x|x|x|...