Google News
logo
JSP - Interview Questions
How are Custom Tags in JSP created?
Custom Tags in JSP are created using the following steps :
 
* Creating the Tag Handler Class
* Creating the TLD File
* Creating the JSP File

Creating the Tag Handler Class : To create a Tag Handler Class, we need to inherit the TagSupport Class and then override doStartTag() method. To write the data for JSP, we need to use the JspWriter class. The PageContext class provides getOut() method which returns the instance of the JspWriter class. Later, the TagSupport class provides an instance of pageContext by default.
 
Creating the TLD File : TLD stands for Tag Library Descriptor file. It contains the information related to the tag and Tag Hander classes. It must be held inside the WEB-INF directory.
 
Creating the JSP File : We will be specifying the path of the TLD file directly. It is recommended to use the URI name instead of full a path of the TLD file. It uses taglib directive to use the tags defined in the TLD file.
Advertisement