You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by Apache Wiki <wi...@apache.org> on 2006/07/18 04:54:17 UTC

[Struts Wiki] Update of "Comparison using nested tag vs JSTL for nested objects on form" by MichaelJouravlev

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by MichaelJouravlev:
http://wiki.apache.org/struts/Comparison_using_nested_tag_vs_JSTL_for_nested_objects_on_form

The comment on the change is:
Moved content to StrutsTags, "Comparison using nested tag vs JSTL for nested obj

------------------------------------------------------------------------------
- === Comparison using nested tag vs JSTL for nested objects on form ===
+ #redirect StrutsTags
+ ## Content is moved to StrutsTags, "Comparison using nested tag vs JSTL for nested objects on form"
  
- Many think that you are required to display nested data using the Nested tag. I agree the Nested tag is the cleaner solution, but just so you are aware you can do this with JSTL as well. (Below assumes JSP2.0)
- 
- companyForm has a List of divisions and for each division in the list there is a list of department objects and we will display the 'name' of each department.
- 
- ''JSTL Solution''
- {{{
- <c:forEach items="${companyForm.divisions}" var="division" varStatus="divstatus">
-     Division: <html:text property="divisions[${divstatus.index}].name" value="${division.name}" /><br>
-     <c:forEach items="${division.departments}" var="department" varStatus="depstatus">
-     --- Department: <html:text property="divisions[${divstatus.index}].departments[${depstatus.index}].name" value="${department.name}" /><br>
-     </c:forEach>
- </c:forEach>
- }}}
- 
- ''Nested Tag Solution''
- {{{
- <nested:root name="companyForm">
-   <nested:iterate property="divisions">
-     Division: <nested:text property="name" /><br>
-         <nested:iterate property="departments">
-         --- Department: <nested:text property="name" /><br>
-         </nested:iterate>
-   </nested:iterate>
- </nested:root>
- }}}
-