• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TLD related

 
Suhas Wadadekar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ, Chapter 9, Pg 495 Q1

The question is:
Which is true about TLD files?

Option D. TLD files can declare both Simple and Classic tags, but TLD files are NOT used to declare Tag Files.
This option is wrong and the explanation says, "Option D is invalid because Tag Files may be declared in a TLD (but it is rare)."

What the heck does Option D mean anyways? I cannot understand the option and hence the explanation did not help me at all.

Thanks,
Suhas.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you remember what a TLD (Tag Library Descriptor) is ? And do you remember its content ? It is used to declare the tags of your library. Here is an example :

With the "tag" tag, you can declare both classic and simple tags.

If you look at the XML Schema of the TLD (JSP Specification, JSP.C.1XML Schema for TLD, JSP 2.0), you'll see that you can also declare Tag Files, using the "tag-file" tag. Here is an example from the spec:
 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you'll see that you can also declare Tag Files, using the "tag-file" tag.


It is definitely valid if we declare the tag file in the jar.We don't need to declare the tag file in the tld under WEB-INF/tags. But is it still valid to declare tag file in the tld under WEB-INF? Just a doubt.
 
raj malhotra
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from jsp2.0 spec
JSP.8.4.3 Packaging Directly in a Web Application

Tag files placed in the /WEB-INF/tags/ directory of the web application, or a
subdirectory, are made easily accessible to JSPs without the need to explicitly
write a Tag Library Descriptor. This makes it convenient for page authors to
quickly abstract reusable JSP code by simply creating a new file and placing the
code inside of it.
.......
....


The JSP container must generate an implicit tag library for each directory
under and including /WEB-INF/tags/.


so looks like it is valid to declare tag file in the tld under WEB-INF, if you dont do yourself jsp container will do for you.

 
Suhas Wadadekar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christopher. Got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic