- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the purpose of taglib directive in JSP?
The taglib directive declares that your JSP page uses a set of custom tags, identifies the location of the library, and provides means for identifying the custom tags in your JSP page.
The taglib directive follows the syntax given below −
<%@ taglib uri = "uri" prefix = "prefixOfTag" >
Where the uri attribute value resolves to a location the container understands and the prefix attribute informs a container what bits of markup are custom actions.
You can write the XML equivalent of the above syntax as follows −
<jsp:directive.taglib uri = "uri" prefix = "prefixOfTag" />
When you use a custom tag, it is typically of the form <prefix:tagname>. The prefix is the same as the prefix you specify in the taglib directive, and the tag name is the name of a tag implemented in the tag library.
For example, suppose the custlib tag library contains a tag called hello. If you wanted to use the hello tag with a prefix of mytag, your tag would be <mytag:hello> and it will be used in your JSP file as follows −
<%@ taglib uri = "http://www.example.com/custlib" prefix = "mytag" %> <html> <body> <mytag:hello/> </body> </html>
- What is a taglib directive in JSP?
- Please share one example of using taglib directive in JSP
- What is a page directive in JSP?
- What is a include directive in JSP?
- What are various attributes Of page directive in JSP?
- What is the difference between include action and include directive in JSP?
- What methods of session object is used frequently in JSP and for what purpose?
- How many types of directive tags JSP supports?
- Please share a running example of include directive in JSP
- What is the purpose of ‘is’ operator in C#?
- What is the purpose of interfaces in java?
- What is the purpose of VOLUME in Dockerfile?
- What is the purpose of the `//` operator in python?
- What is the purpose of System Programs?
- What is the purpose of System Calls?