Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do I have to create a .jar for custom tag ?

 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created

1) WEB-INF/mytag.tld file
2) web.xml: <taglib-uri>/WEB-INF/mytag.tld</taglib-uri>
<taglib-location>/WEB-INF/mytag.tld</taglib-location>
3) test.jsp: <%@ taglib uri="/WEB-INF/mytag.tld" prefix="test" %>
4) WEB-INF/classes/MyTag.class

and it all works.

But some tutorials/books suggest we create a .jar file including the Tag handler classes, tld, and include the .jar in WEB-INF/lib/, after that for the "uri" part it can either directly points to that .jar or indirectly points to a symbolic name; similarly "taglib-location" can points to that .jar.

My question is -- Is it "required" to follow this step of creating a .jar for the custome tag ? What if I don't create a .jar in WEB-INF/lib ? What problem will my current setting (without a .jar)cause in a production environment ? Although I don't really see any problem with it, I want to confirm as I am not very familiar with custom tag stuff.
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As I experienced, it is only to be distributable. It doesn't affect anything.
But I might be wrong...
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's and excellent article by BrettMcLaughlin (O'Reilly) on why taglibs ought to be 'jarred' and how to go about it.

ram.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic