Paul Benedict wrote the following on 11/7/2005 7:38 PM:

You are much better off using JSTL so you can write something like:
<html:textarea property="${form.object[i].subobject[j].property"/>

Actually the above is not what you probably want at all. The above is not going to write out the name of the property correctly. You probably mean something like...

<html:textarea property="someObject[${aProp.someIndex}].subobject[${bProp.someIndex}].someField"/>


Once you go JSTL, you never go back :-) Which makes the <nested> object tags 
obsolete.

I would disagree there. I love JSTL, but the nested tag is nice and makes things much cleaner.

Compare a JSTL version vs Nested tag version:

<%-- NESTED TAG WAY OF DOING IT: --%>

<nested:iterate property="departments">
    Department: <nested:text property="deptName"/><br/><br/>
    <div style="margin-left:10px">
        <nested:iterate property="employees">
            Employee: <nested:text property="empName"/>
            E-mail: <nested:text property="email"/><br/>
        </nested:iterate>
    </div>
    <br/><br/>
</nested:iterate>

<%-- JSTL WAY OF DOING IT: --%>

<c:forEach items="${companyForm.departments}" var="dept" varStatus="deptStatus"> Department: <html:text property="departments[${deptStatus.index}].deptName" value="${dept.deptName}" /><br/>
    <div style="margin-left:10px">
<c:forEach items="${dept.employees}" var="emp" varStatus="empStatus"> Employee: <html:text property="departments[${deptStatus.index}].employees[${empStatus.index}].empName" value="${emp.empName}" /> E-mail: <html:text property="departments[${deptStatus.index}].employees[${empStatus.index}].email" value="${emp.email}" />
            <br/>
        </c:forEach>
    </div>
    <br/><br/>
</c:forEach>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to