To use a custom tag from your tag library in a JSP page, you must first obtain a reference to that library. You must use the JSP taglib directive for this purpose. You specify the location of the tag library in the uri attribute of the directive.
We recommend that you define the location of the tag library in the deployment descriptor of your Web application, instead of specifying the location directly in the uri attribute. You can use the <taglib> group of tags to do this. For example, our HelloWorld tag library location is defined as follows:
... <taglib> <taglib-uri> HelloWorld </taglib-uri> <taglib-location> /WEB-INF/taglib.tld </taglib-location> </taglib> ... |
You can then use the following taglibdirective in your JSP to reference the HelloWorld tag library:
<%@ taglib uri="HelloWorld" prefix="hello" %> |
In the body of your JSP page, you can use the <hello:HelloWorld> tag to embed the Hello World message.