Java Reference
In-Depth Information
Just as with the <c:if> tag, we can drag and drop the JSTL Choose item from the
NetBeans palette into our page.
After dropping the JSTL Choose item into the appropriate location in our page, we
are prompted for additional information.
The JSTL <c:choose> tag needs to have one or more nested <c:when> tags, and
optionally, a <c:otherwise> tag. In the Insert JSTL Choose window we indicate
how many <c:when> tags we need, and if we need a <c:otherwise> statement.
After filling out the fields in the Insert JSTL Choose window as shown in the
screenshot, the following markup is generated in our page:
<c:when test="">
<c:when test="">
We of course need to fill the body and the value of the test attribute for each
<c:when> tag, and the body of the <c:otherwise> tag. After doing just that and
adding some additional markup both before and after the <c:choose> tag, the body
of our page now looks like this:
<h2>Hello World!</h2>
Search WWH ::

Custom Search