Chapter 4. Iteration Actions

Topics in This Chapter

  • The <c:forEach> Action

  • The <c:forTokens> Action

  • Iteration Status

  • Custom Iteration Actions

In any programming language, the ability to iterate over a set of values is essential. Before JSTL, JSP did not provide an explicit means to accomplish that fundamental task, so developers had two choices: use a scriptlet or implement a custom action, neither of which is very attractive.

JSTL provides two actions that iterate over a set of values: <c:forEach> and <c:forTokens>. JSTL also exposes an interface and two classes that you can use to implement custom iteration actions: LoopTag, LoopTagSupport, and LoopTagStatus, respectively.[1] This chapter describes the <c:forEach> and <c:forTokens> actions and shows ...

Get Core JSTL: Mastering the JSP™ Standard Tag Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.