common:subList

This taglib lets you get a subset of the given list. Useful for showing parts of a list. The list could contain almost anything as long as it's a collection.

Parameters

Name Required Default Type Description
id true   Object/String The result is stored in this variable.
list true   Object/String The list we want to limit.
startIndex false 0 Object/String If you wish to exclude the initial x elements – state this number.
count false true Object/String How many elements should be included from the startIndex.
         
         


ID-result variable contains: A list containg a sublist of the original list.

Examples

This will result in that the variable "sublist" will contain a list which contains the first 5 elements of the original list.

<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="infoglue-content" prefix="content" %>
<%@ taglib uri="infoglue-structure" prefix="structure" %>
<%@ taglib uri="infoglue-page" prefix="page" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<page:pageContext id="pc"/>
<structure:childPages id="childPages" siteNodeId="${pc.siteNodeId}"/>
<common:sublist id="sublist" list="${childPages}" count="5"/>

You can also add a starting index like this below:

<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="infoglue-content" prefix="content" %>
<%@ taglib uri="infoglue-structure" prefix="structure" %>
<%@ taglib uri="infoglue-page" prefix="page" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<page:pageContext id="pc"/>
<structure:childPages id="childPages" siteNodeId="${pc.siteNodeId}"/>
<common:sublist id="sublist" list="${childPages}" startIndex="1" count="3"/>
This will result in that the variable "sublist" will contain a list which contains the elements 2-4.



comments powered by Disqus