Hello everyone,
I need your help with a tricky problem, where I do not see any explanation
currently:
I try to construct a table with all data items stored in a database using
Hibernate.
There is a Form bean for the data items themselves and a form bean with a
Collection (ArrayList) with the list of all such data items.
Here is the relevant JSP code
<logic:present name="InterfacesOverviewForm">
<logic:notEmpty name="InterfacesOverviewForm"
property="interfacesItems">
<table>
<logic:iterate
id="InterfacesOverviewData"
name="InterfacesOverviewForm"
property="interfacesItems"
type="de.Platinion.rr.QuestGen.P200038_26.Presentation.form.InterfacesInputFo
rm">
<tr>
<td>
<html:text name="InterfacesOverviewData" property="mainId" size="2"/> // put
one property of the interfaces data item into the table cell (**)
.
.
.
</logic:notEmpty>
<logic:empty name="InterfacesOverviewForm"
property="interfacesItems">
No Interfaces data items stored yet. <br
/>
</logic:empty>
</logic:present>
<logic:notPresent name="InterfacesOverviewForm">
No Interfaces data items available. <br />
</logic:notPresent>
In my OverviewInterfacesAction I do the following:
...
Collection lDTOList = lService.readData(); // read data from the persistence
layer
ArrayList lFormInterfacesList = new ArrayList(); //
the list of form beans
lFormInterfacesList = (ArrayList) convert(lDTOList);
convert DTO's to form beans
lForm.setInterfacesItems(lFormInterfacesList); // set
the form bean collection into the form
pRequest.setAttribute("InterfacesOverviewForm",lForm); // place the form with
the collection into the request
return (pMapping.findForward(Constants.SUCCESS)); //
done
}
I expect that in my JSP, The iterate gets in each iteration one form after
the other out of the collection and that I have access to the properties of
the collection elements as in line (**)
Unfortunately there are two effects that I cannot explain:
1) With the code as above I get an Exception stating, that bean
InterfacesOverviewData cannot be found in any scope
2) If I start the JSP with a
<bean:define id="InterfacesOverviewData"
name="InterfacesOverviewForm"
type="de.Platinion.rr.QuestGen.P200038_26.Presentation.form.InterfacesOvervie
wForm"/>
I still get a different exception, but this time stating, that there is no
getter method for property mainId in form InterfacesOverviewForm, which is
correct since that form contains a Collection with elements which all have a
property mainId and getter getMainId().
3) If I try to access the Collection instead of a property in line
(**), i.e. I change the line to:
<html:text name="InterfacesOverviewData" property="interfacesItems"
size="150"/>
Then I see the the ArrayList printed (I provided a toString() method in the
InterfacesInputForm (i.e. the form which represents an element of the
Collection), thoug obviously the Collection is there and can be accessed.
4) A further observation which I cannot explain might indicate that the
heart of my error in not caused by the logic:iterate tag itself:
both branches of the surrounding logic:present and logic:empty checks, i.e.,
logic:present and logic:notPresent and logic:empty and logic:notEmpty are
executed (with the code as described until (3))
Any help or hint is highly appreciated!
Thanks in advanced
Robert
Dr. Robert Riemann | IT Architect
Platinion GmbH
A Company of The Boston Consulting group
Ridlerstr. 31b 80339 Munich/Germany
Tel. +49 (0) 89 54545-53 22 Mobile +49 (0) 160 532 33 22
Fax +49 (0) 89 5108 2900
mailto:[EMAIL PROTECTED]
http://www.platinion.de