custom tag libraries

currently i am working on custom tag libraries. i wrote a tag library and tried to configure it in web.xml. but <taglib> is not allowed in web.xml. I am using servlet 2.5 specification. please guide me.

Including taglib elements in the web.xml deployment descriptor is hardly ever necessary. If the .tld files are in the right location they will be discovered 'automagically'.
Anyway, as of version 2.4 of the servlet specification the xml schema definition for web.xml has changed and become more stringent. You can still add taglib elements to it, but the must be child elements of a parent element called jsp-config. Though I'd recommend you simply put the .tld files in the proper location for auto-discovery, and not include them in the web.xml explicitly.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218

posted Jul 02, 2012 05:16:26

0

Thanks Jelle Klap.

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218

posted Jul 02, 2012 05:20:24

0

I kept the tld file in WEB-INF folder. i used uri in tld file to locate the tld. It worked.

Thanks Jelle klap.

can you also tell me what are the other places where we can keep our tld files so that server automatically detects.

Well in the WEB-INF folder, as you already figured out, but also any subfolder of WEB-INF.
There's also the option of including .tld files in the META-INF folder inside JAR files in WEB-INF/lib.

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218

posted Jul 02, 2012 06:26:37

0

Jelle Klap wrote:Well in the WEB-INF folder, as you already figured out, but also any subfolder of WEB-INF.
There's also the option of including .tld files in the META-INF folder inside JAR files in WEB-INF/lib.