✔ JSTL CHAPTERS:-
JSTL (JSP Standard Tag Library)
JSTL Core Tags
JSTL Formatting Tags
JSTL Functions
Custom Tags With Body
Custom Tags With Attributes
JSP Interview Questions
JSTL (JSP Standard Tag Library)
JSTL Core Tags
JSTL Formatting Tags
JSTL Functions
Custom Tags With Body
Custom Tags With Attributes
JSP Interview Questions
Custom tags:
Custom tags are the user defined tags. These tags are mainly used for code re-usability.
Advantages of custom tags:
- 1. Code re-usability.
- 2. Scriptlet tags are not needed.
How to use custom tag?
A custom tag may have zero or n attributes.
How to create a custom tag?
Steps to create a custom tag:
- 1. Tag handler class: is used to write the action for the custom tag. Our tag handler class inherits the TagSupport class. Custom tag action will be written in the doStartTag() method of TagSupport class.
- 2. TLD file: It refers to the Tag Library Descriptor file. This file contains the tag name, tag attributes and tag handler class. A TLD file should have .tld extension. It should be inside the WEB-INF directory.
Commonly used attributes in TLD file:
1. : Name of the custom tag.
2. : Fully qualified name of the tag handler class.
- 3. JSP page: This is normal JSP page where we use created custom tag.
Example:
CustomTag.java
firsttag.tld
test.jsp
web.xml
No comments:
Post a Comment