Form not returning data after reload in Struts 1

15 Views Asked by At

I want to populate a list of DTO's inside a list of DTO's with struts 1.

For some reason the children of the parents get lost when the form is returned to the backend.

I've struggled with Struts 1, <html:options, <html:optionsCollection and even <nested: tags but no avail (yet).

Can anyone help me out?

The options in the c:forEach get rendered properly but as soon as the form is submitted the parents don't have children anymore.

<logic:iterate id="parent" property="listOfParents"
               name="myForm" indexId="index"
               type="my.package.SomeDTO">

...

<html:select name="myForm"
             property="selected[${index}]"
             styleClass="form-control">
    <html:option value="null" key="label.select"/>
    <c:forEach var="item" items="${parent.children}">
        <html:option
                value="${item.id}">${item.label}</html:option>
    </c:forEach>
</html:select>

...

</logic:iterate>

(This happens in this code:)

public ActionForward someBusinessLogic(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                           final HttpServletResponse response) {

    final MyForm myForm  = (MyForm) form; // --> here the children are gone :(
0

There are 0 best solutions below