• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag Libraries

 
Abhinav Sharma
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I am in deep trouble. Can anyone tell me What is tag library?
Actually i am using Jrun. And the book i am from where i am reading is based on weblogic server. So the syntax which they use for taglib directive is :-
<%@ taglib uri="META-INF.taglib.tld" prefix="example" %>
Where else uri is the path for the tld file. In JRun there is no file whose extension is tld. Infact there is no file with the extention of tld in my whole hard disk. Does that means that tag library directory is only possible through web logic server and through Jrun. There is no folder which has its name META-INF but there is one folder which has got name web-inf. How do i create or use tag library. Can anyone tell what does this tag library does and how it is important.
I have by mistake posted this same topic in Applets forum where Mr tim said "The taglibrary descriptor is simply an XML file that describes the tag library's properties. The recommended location to store tlds is in WEB-INF, not META-INF, since that's a convenient place for items that the user should not have direct access to but are needed by the web application. The tag classes themselves are in the WEB-INF/class or WEB-INF/lib directories just like all the other classes for the web app." But the book i am reading says that is is in META-INF. And i have searched for the tld files in web-inf file also but there was a file whose name is "web.xml". Is this the same file which we have access for taglibrary. Please give me some diea.
Thanks in advance
abhinav
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhinav,
As Tim said, you should create your own Tab Library Descriptor (tld).
Do you have a JRun server installed in your m/c on in your n/w?
Then you can place any directory related to web-app root
directoy. For simple programs you can put tlds in same directory where you store your jsps.
and cans simply specify uri attribute as attribute="myTag.tld".
If you are new to tag libraries refer a book first.
Cheers
Binu
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not really important where you put your taglibrary descriptors as long as they are accessible by the JSP. I don't recommend putting them in the same directory as the web pages, because that directory is often wide open to direct client access . People could do an HTTP GET for http://www.myservr.com/mytags.tld and possibly view the TLD file, which means that they can find out things about the inner workings of your website that might help them do something bad.
WEB-INF/web.xml is a file used by the application server to describe the application and really has nothing to do with tags.
META-INF is the place where general information about a Java Archive (JAR) is stored, and is unimportant to a web app. If the application wasn't stored in a JAR, this directory probably won't even exist. That may be another reason why TLDs are recommended to go in WEB-INF, instead.
I haven't worked with JRUN since before JSPs existed - if you have an old copy, maybe the is the reason you don't have any examples is that all that stuff is relatively new.
A TLD isn't mandatory, BTW. They're only needed to support custom tags. Also, it's not uncommon to have multiple taglibraries in a project. Right now, the jakarta Struts system makes use of 4. Each one has its own taglibrary descriptor file (TLD).
 
Bill Siggelkow
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The convention I have used is store tld files in WEB-INF\tlds
 
Abhinav Sharma
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks tim and binu for your much requiered help. I am working on your suggestions. And sorry could not come lately.
abhinav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic