This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JSP and the fly likes do I have to create a .jar for custom tag ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "do I have to create a .jar for custom tag ?" Watch "do I have to create a .jar for custom tag ?" New topic

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

Frank Sikuluzu
Ranch Hand

Joined: Dec 16, 2003
Posts: 116
I have created

1) WEB-INF/mytag.tld file
2) web.xml: <taglib-uri>/WEB-INF/mytag.tld</taglib-uri>
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

Joined: Jul 12, 2004
Posts: 69

As I experienced, it is only to be distributable. It doesn't affect anything.
But I might be wrong...

F.<br />SCJP, SCJD, SCWCD, SCBCD<br /> <br />Failure is not an option... It comes with the software bundle.
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Here's and excellent article by BrettMcLaughlin (O'Reilly) on why taglibs ought to be 'jarred' and how to go about it.

I agree. Here's the link:
subject: do I have to create a .jar for custom tag ?
It's not a secret anymore!