You are here: Reference > Streams and JSP > JSP Tags > choose

  choose JavaServer Page tag

JavaServer Pages tags

Use the choose JSP tag to select at most one enclosed branch of when tags.

Include one or more when tags and a final otherwise tag within the scope of the choose tag.

The choose tag has no attributes. For example:

<pega:choose>
  <pega:when zzzz1 >
       <!-- HTML or XML code to execute for first when -->
  </pega:when>
  <pega:when zzzz2 >
     <!-- HTML or XML code to execute for second when -->
  </pega:when>
 <pega:otherwise>
   <!-- selected if no previous when tag evaluates to true -->
  </pega:otherwise>
</pega:choose>

where zzzz1 and zzzz2 are a name=, test=, or other valid set of when JSP tag attributes.

NoteYou can nest when tags within when tags. You can't use JSP tags other than when and otherwise within the scope of a choose tag.

Related topics when JavaServer Page tag

UpJavaServer Page tags