Some Java Guy
Some Java Guy

Reputation: 5118

Import custom taglib

We usually give reference to external taglib as <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

Can we define our custom taglib and uri in our jsp as below?

<%@ taglib uri="com.mycompany.taglib" prefix="custom"%>

Upvotes: 1

Views: 1540

Answers (3)

Ulrich von Poblotzki
Ulrich von Poblotzki

Reputation: 456

Yes, one cane define custom tags. Take a look at this Java EE tutorial.

Upvotes: 0

user1085746
user1085746

Reputation: 303

Yes, you need to to have tablib.tld file with your tags definitions and the taglib section with in web.xml

Upvotes: 0

Harry Joy
Harry Joy

Reputation: 59686

Can we define our custom taglib?

Yes

What you have to do is create a tag handler class and tld file then import that tld file in your jsp page as

<%@taglib prefix="myCustomTag" tagdir="/WEB-INF/myCustomerTag.tld"%>

Useful links:

Upvotes: 3

Related Questions