JSP Tags

This section describes you about the various aspects of JSP tags such as what is JSP tag, list of JSP tags, JSP custom tags and many more things.

JSP Tags

JSP Tags

In this section we will learn about the JSP tags.

This section describes you about the various aspects of JSP tags such as what is JSP tag, list of JSP tags, JSP custom tags and many more things.

What is JSP Tags ?

Tags in JSP are like the HTML tags. These tags are used for doing specific tasks in a JSP page. Each tag has its own functionality. Tags in JSP, like the HTML tags, are written within the characters '<' and '>' however, different types of tags uses additional characters within '<' and '>' characters.

List of JSP Tags

As we discussed above there are different types of tags in JSP. These are as follows :

  • JSP Scriptlet Tag : Scriptlet tag in JSP is used to write Java codes. Scriptlet tag is started with the characters '<%' and ends with the characters '%>'. Java code is written within this tag.
     
  • JSP Declaration Tag : Declaration tag in JSP is used to declare fields and methods as declared in the Servlet body. Declaration tag is started with the characters '<%!' and ends with the characters '%>'. Methods and fields are declared within this tag.
     
  • JSP Expression Tag : Expression tag in JSP is used to contain the expression value of scripting language. Expression tag is started with the characters '<%=' and ends with the characters '%>'. Expression is expressed within this tag.
     
  • JSP Directive Tag : Directive tags in JSP is used to provide the special information to JSP engine for example, package importing, session etc. Directive tag is started with the characters '<%@' and ends with the characters '%>'
     
  • JSP Action Tag : Action tags in JSP is used to apply built-in functionality. Action tag is started as '<jsp:tagName>' and ends with '</jsp:tagName>'. Body of the tag is defined within these tags, if there is no need to define body JSP Action tag can be used as <jsp:tagName />

JSP Custom Tags

Custom tag in JSP is know as user defined tag. In JSP a user can create its own tag for performing the specific task. Tag library is a collection of custom tag it contains the defined set of related custom tags and holds the object which implements the tags. Tag handler object implements a custom tag. TagLibraryDescriptor(tld) is an XML file contains the information about whole library and every tag (contained in the library).