You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jarnot Voytek Contr AU/SC <Vo...@MAXWELL.AF.MIL> on 2004/03/29 19:02:22 UTC

nesting c:forEach loops

Is it possible to nest forEach loops and have the html:text input fields
work correctly?

My JSP code: 
<c:forEach items="${applicationForm.schools}" var="school">
  <tr>
    <td>
      <html:text indexed="true" name="school" property="name"/>
    </td>
  </tr>
  <c:forEach items="${school.courses}" var="course">
    <tr>
      <td>
        <html:text indexed="true" name="course" property="courseTitle"/>
      </td>
    </tr>
  </c:forEach>
</c:forEach>

Within the second loop, input field names are rendered as
course[0].courseTitle rather than the required
school[0].course[0].courseTitle.  Any ideas on nesting these loops?  I'd
rather stick with JSTL and html-el rather than the nested taglib.


--
Voytek Jarnot
Quantum materiae materietur marmota monax si marmota monax materiam possit
materiari?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: nesting c:forEach loops

Posted by Mark Lowe <ma...@boxstuff.com>.
If you're using dynaActionForm you need to extract the map from the 
dynaForm.

${applicationForm.map.schools}

other than that looks like it should work just fine as it is.


On 29 Mar 2004, at 19:02, Jarnot Voytek Contr AU/SC wrote:

> Is it possible to nest forEach loops and have the html:text input 
> fields
> work correctly?
>
> My JSP code:
> <c:forEach items="${applicationForm.schools}" var="school">
>   <tr>
>     <td>
>       <html:text indexed="true" name="school" property="name"/>
>     </td>
>   </tr>
>   <c:forEach items="${school.courses}" var="course">
>     <tr>
>       <td>
>         <html:text indexed="true" name="course" 
> property="courseTitle"/>
>       </td>
>     </tr>
>   </c:forEach>
> </c:forEach>
>
> Within the second loop, input field names are rendered as
> course[0].courseTitle rather than the required
> school[0].course[0].courseTitle.  Any ideas on nesting these loops?  
> I'd
> rather stick with JSTL and html-el rather than the nested taglib.
>
>
> --
> Voytek Jarnot
> Quantum materiae materietur marmota monax si marmota monax materiam 
> possit
> materiari?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: nesting c:forEach loops

Posted by Mark Lowe <ma...@boxstuff.com>.
On 29 Mar 2004, at 19:17, Julio Cesar De Salvo wrote:

> You have to use the html-el tag libraries in the contrib. directory.

No you don't..

>
> Julio
>
> -----Mensaje original-----
> De: Jarnot Voytek Contr AU/SC [mailto:Voytek.Jarnot@MAXWELL.AF.MIL]
> Enviado el: Lunes, 29 de Marzo de 2004 02:02 p.m.
> Para: 'user@struts.apache.org'
> Asunto: nesting c:forEach loops
>
> Is it possible to nest forEach loops and have the html:text input 
> fields
> work correctly?
>
> My JSP code:
> <c:forEach items="${applicationForm.schools}" var="school">
>   <tr>
>     <td>
>       <html:text indexed="true" name="school" property="name"/>
>     </td>
>   </tr>
>   <c:forEach items="${school.courses}" var="course">
>     <tr>
>       <td>
>         <html:text indexed="true" name="course" 
> property="courseTitle"/>
>       </td>
>     </tr>
>   </c:forEach>
> </c:forEach>
>
> Within the second loop, input field names are rendered as
> course[0].courseTitle rather than the required
> school[0].course[0].courseTitle.  Any ideas on nesting these loops?  
> I'd
> rather stick with JSTL and html-el rather than the nested taglib.
>
>
> --
> Voytek Jarnot
> Quantum materiae materietur marmota monax si marmota monax materiam
> possit
> materiari?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: nesting c:forEach loops

Posted by Julio Cesar De Salvo <jd...@itechnology.com.ar>.
You have to use the html-el tag libraries in the contrib. directory.

Julio

-----Mensaje original-----
De: Jarnot Voytek Contr AU/SC [mailto:Voytek.Jarnot@MAXWELL.AF.MIL] 
Enviado el: Lunes, 29 de Marzo de 2004 02:02 p.m.
Para: 'user@struts.apache.org'
Asunto: nesting c:forEach loops

Is it possible to nest forEach loops and have the html:text input fields
work correctly?

My JSP code: 
<c:forEach items="${applicationForm.schools}" var="school">
  <tr>
    <td>
      <html:text indexed="true" name="school" property="name"/>
    </td>
  </tr>
  <c:forEach items="${school.courses}" var="course">
    <tr>
      <td>
        <html:text indexed="true" name="course" property="courseTitle"/>
      </td>
    </tr>
  </c:forEach>
</c:forEach>

Within the second loop, input field names are rendered as
course[0].courseTitle rather than the required
school[0].course[0].courseTitle.  Any ideas on nesting these loops?  I'd
rather stick with JSTL and html-el rather than the nested taglib.


--
Voytek Jarnot
Quantum materiae materietur marmota monax si marmota monax materiam
possit
materiari?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org