J
Jack_A
Hello!
I have a problem with struts tag <logic:iterate>
There is a bean TestBean.java contains array of some class (e.g. B)
and class B also contains array of some class (e.g. C)
public class B{
private C[] arrayC;
public B(int n){
arrayC = new C[n];
int j;
for(j = 0;j<n; j++){
arrayC[j] = new C();
}
}
public C[] getArrayC() { return arrayC;}
public C getArrayC(int index) { return arrayC[index];}
}
public class TestBean {
private B[] arrayB;
public TestBean(int n){
arrayB = new B[n];
int j;
for(j = 0;j<n; j++){
arrayB[j] = new B(n);
}
}
public B[] getArrayB() { return arrayB;}
public B getArrayB(int index) { return arrayB[index];}
}
There is some code of jsp page:
<%TestBean testBean = new TestBean(5);
session.setAttribute("testBean", testBean);
%>
<table>
<logic:iterate id="test" name="testBean" property="arrayB"
indexId="i"
scope="session">
<tr>
<td align="right"><html:text name='test'
property="array"/>
<logic:iterate id="test2" name="test"
property="arrayC" indexId="j">
<td align="right"><html:text name='test2'
property="fielsOfClassC"/>
</logic:iterate>
<tr />
</logic:iterate>
</table>
I try to iterate each element of arrayC, which is element of arrayB
(which I try to iterate too) .
But "[ServletException in:/testApp/test.jsp] Cannot create iterator
for this collection'"
Sorry if I wasn't very clear.
Can anyone give me some advice?
I have a problem with struts tag <logic:iterate>
There is a bean TestBean.java contains array of some class (e.g. B)
and class B also contains array of some class (e.g. C)
public class B{
private C[] arrayC;
public B(int n){
arrayC = new C[n];
int j;
for(j = 0;j<n; j++){
arrayC[j] = new C();
}
}
public C[] getArrayC() { return arrayC;}
public C getArrayC(int index) { return arrayC[index];}
}
public class TestBean {
private B[] arrayB;
public TestBean(int n){
arrayB = new B[n];
int j;
for(j = 0;j<n; j++){
arrayB[j] = new B(n);
}
}
public B[] getArrayB() { return arrayB;}
public B getArrayB(int index) { return arrayB[index];}
}
There is some code of jsp page:
<%TestBean testBean = new TestBean(5);
session.setAttribute("testBean", testBean);
%>
<table>
<logic:iterate id="test" name="testBean" property="arrayB"
indexId="i"
scope="session">
<tr>
<td align="right"><html:text name='test'
property="array"/>
<logic:iterate id="test2" name="test"
property="arrayC" indexId="j">
<td align="right"><html:text name='test2'
property="fielsOfClassC"/>
</logic:iterate>
<tr />
</logic:iterate>
</table>
I try to iterate each element of arrayC, which is element of arrayB
(which I try to iterate too) .
But "[ServletException in:/testApp/test.jsp] Cannot create iterator
for this collection'"
Sorry if I wasn't very clear.
Can anyone give me some advice?