Displaying a Forum

To lists all the threads in a forum:

<c:if test="${!empty param.forumId}">
  <forum:forum id="forum" forumId="${param.forumId}"/>
  <h2>Threads in this forum (with forum ID ${param.forumId})</h2>
  Number of threads: ${forum.threadCount}.
  Number of postings: ${forum.postingCount}.
  <ul>
    <c:forEach var="theThread" items="${forum.threads}">
      <li>
        <a href="${forum.url}/posting/${theThread.id}">
          Title is "${theThread.title}"
          and thread ID is ${theThread.id}
        </a>
      </li>
    </c:forEach>
  </ul>        
</c:if>

The most significant points in the above listing are highlighted and described below:

<forum:forum id="forum" forumId="${param.forumId}"/>

The forum:forum tag (see forum:forum) is used to create a PresentationForum bean (see PresentationForum) called forum.

<c:forEach var="theThread" items="${forum.threads}">

The code cycles through the first 10 threads in the forum, creating a PresentationThread bean (see PresentationThread) called theThread to represent each thread.