Types of Tags

Simple tags are invoked using XML syntax. They have a start tag and an end tag, and possibly a body:

<tt:tag>
  body
</tt:tag>

A custom tag with no body is expressed as follows:

<tt:tag /> or <tt:tag></tt:tag>

Tags with Attributes

A simple tag can have attributes. Attributes customize the behavior of a custom tag just as parameters customize the behavior of a method. There are three types of attributes:

  • Simple attributes

  • Fragment attributes

  • Dynamic attributes

Simple Attributes

Simple attributes are evaluated by the container before being passed to the tag handler. Simple attributes are listed in the start tag and have the syntax attr="value". You can set a simple attribute value from a String constant, or an expression language ...

Get The J2EE™ Tutorial Second Edition 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.