Java Reference
In-Depth Information
Core JSTL tags
NetBeans allows us to easily use three core JSTL tags:
• The <c:if> tag, used to conditionally render segments of a page
• The <c:choose> tag, that allows us to render part of a page differently
based on a Boolean condition
• The <c:forEach> tag, that allows us to iterate through an instance of a class
implementing java.util.Collection or through an array
These tags can be dragged from the NetBeans palette into our page.
By convention, the prefix of c is used for JSTL core tags. The value of the uri
attribute is a Unique Resource Identifier (URI) that will let our page know where to
find the custom tags. Each tag library defines its URI in a tag library descriptor file.
For JSTL core tags, the value of the uri attribute must always be http://java.sun.
com/jsp/jstl/core .
Conditionally displaying part of a page with
the <c:if> tag
The JSTL <c:if> tag allows us to conditionally display or hide part of a page, based
on a Boolean condition. With NetBeans, all we need to do to add a JSTL <c:if> tag
to one of our JSP pages is to drag the JSTL If item from the palette to the location in
our page where we wish to place the tag.
After dragging the JSTL If item to our page, NetBeans prompts us for additional
information.
 
Search WWH ::




Custom Search