R
Rode
On the Site http://jakarta.apache.org/struts/faqs/indexedprops.html I
found a good way to use indexed and nested properties. I have a Bean
with several Arrays. The bean looks like this:
*******
public class DataBeurteilung implements Serializable {
public RecordHauptaufgabe hauptAufgArray[];
public RecordHauptaufgabe getHauptAufgRecord(int index) {
return this.hauptAufgArray[index]; }
}
*******
I fill the Array in one of my Actions and forward to the xx.jsp.
The source of my jsp looks like that:
*******
<logic:iterate id="foo" name="dataBeurteilung"
property="hauptAufgArray" indexId="ctr">
<html:textarea name='dataBeurteilung'
property='<%= "hauptAufgRecord[" + ctr + "].massnVG" %>'/>
</logic:iterate>
*******
'dataBeurteilung' is my bean, written to the session. (including the
arrays)
'hauptAufgArray' is the Array with several records as
RecordHauptaufgabe. There is a getter- and settermethod for every
Attribute in the RecordHauptaufgabe-Class.
'massnVG' is one of the Attributes in RecordHauptaufgabe.
The jsp works very well and shows exactly the data I want him to.
Now I created an ActionForm to receive the modified data and I guess,
there's my Problem. The ActionForms content looks like this:
*******
private RecordHauptaufgabe hauptAufgRecord[] = new
RecordHauptaufgabe[15];
public void setHauptAufgRecord(int index, RecordHauptaufgabe record) {
hauptAufgRecord[index] = h; }
public RecordHauptaufgabe getHauptAufgRecord(int index) {
return hauptAufgRecord[index]; }
*******
If I submit the rendered html-page I get the Error
[BeanUtils.populate]: java.lang.IllegalArgumentException...
I also tried to change the setter-method to:
*******
public void setHauptAufgRecord(int index, Object record) {
hauptAufgRecord[index] = (RecordHauptaufgabe)h; }
*******
Nothing works... How has my getter-/settermethod to look like?? I'm
pretty shure, that my way with the indexed and nested properties is
the best way to handle my Arrays.
Please help, soon....
found a good way to use indexed and nested properties. I have a Bean
with several Arrays. The bean looks like this:
*******
public class DataBeurteilung implements Serializable {
public RecordHauptaufgabe hauptAufgArray[];
public RecordHauptaufgabe getHauptAufgRecord(int index) {
return this.hauptAufgArray[index]; }
}
*******
I fill the Array in one of my Actions and forward to the xx.jsp.
The source of my jsp looks like that:
*******
<logic:iterate id="foo" name="dataBeurteilung"
property="hauptAufgArray" indexId="ctr">
<html:textarea name='dataBeurteilung'
property='<%= "hauptAufgRecord[" + ctr + "].massnVG" %>'/>
</logic:iterate>
*******
'dataBeurteilung' is my bean, written to the session. (including the
arrays)
'hauptAufgArray' is the Array with several records as
RecordHauptaufgabe. There is a getter- and settermethod for every
Attribute in the RecordHauptaufgabe-Class.
'massnVG' is one of the Attributes in RecordHauptaufgabe.
The jsp works very well and shows exactly the data I want him to.
Now I created an ActionForm to receive the modified data and I guess,
there's my Problem. The ActionForms content looks like this:
*******
private RecordHauptaufgabe hauptAufgRecord[] = new
RecordHauptaufgabe[15];
public void setHauptAufgRecord(int index, RecordHauptaufgabe record) {
hauptAufgRecord[index] = h; }
public RecordHauptaufgabe getHauptAufgRecord(int index) {
return hauptAufgRecord[index]; }
*******
If I submit the rendered html-page I get the Error
[BeanUtils.populate]: java.lang.IllegalArgumentException...
I also tried to change the setter-method to:
*******
public void setHauptAufgRecord(int index, Object record) {
hauptAufgRecord[index] = (RecordHauptaufgabe)h; }
*******
Nothing works... How has my getter-/settermethod to look like?? I'm
pretty shure, that my way with the indexed and nested properties is
the best way to handle my Arrays.
Please help, soon....