GetLoopingElementList

Description

This JSP function can be used as an alternative to the loopXML JSP tag.

If your application servers only supports up to JSP specification version 1.1, and you need to include another JSP (using jsp:include) within the loop, use this function.

Syntax

ArrayList getLoopingElementList(String binding)

Input parameters

binding - Required. The XML binding to the element within an XML that you want to repeat.

Output parameters

An ArrayList containing the list of elements that you can then use in a loop.

JSP usage

This example loops on the xml:PromiseList:/Promise/Options/@Option element. For each iteration of the loop, it includes the /om/lineschedule/list/lineschedule_list_option.jsp JSP file.

Note that loop element is set into an attribute of the pageContext so that it is be available within the included JSP.

<td colspan="6" style="border:1px ridge black">
   <%  ArrayList optList = getLoopingElementList("xml:PromiseList:/Promise/Options/@Option");
for (int OptionCounter = 0; OptionCounter < optList.size(); OptionCounter++) {
	  YFCElement singleOpt = (YFCElement) optList.get(OptionCounter);
	  pageContext.setAttribute("Option", singleOpt); %>
 <% request.setAttribute("Option", 
(YFCElement)pageContext.getAttribute("Option")); %>
<jsp:include page="/om/lineschedule/list/lineschedule_list_option.jsp"
flush="true">
</jsp:include>
   <% } %> 
</td>