Mill (Iterator) Viewtool documentation for the dotCMS Content Management System

DEPRECATED: Use the LoopTool instead.

The mill tool is a convenience tool to use with #foreach loops. It wraps a list to let the designer specify a condition to terminate the loop, and reuse the same list in different loops.

The following example shows how the mill tool is mapped in the toolbox-xml file:



This lets you do things like:

  context.put("mill", new IteratorTool());


  #set ($list = [1, 2, 3, 5, 8, 13])
  #set ($numbers = $mill.wrap($list))

  #foreach ($item in $numbers)
  #if ($item < 8) $numbers.more()#end



   1 2 3 5 8

Warning: It is not recommended to use hasNext() with this tool as it is used to control the #foreach. Use hasMore() instead.

LoopTool Javadoc: LoopTool