Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag Files Packaging in a Web Application

 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source: JSP Spec 2.0 JSP.8.4.3 Pg 213 Packaging Directly in a Web Application

The JSP container must interpret the /WEB-INF/tags/ directory and each
subdirectory under it, as another implicitly defined tag library containing tag
handlers defined by the tag files that appear in that directory. There are no special
relationships between subdirectories - they are allowed simply for organizational
purposes. For example, the following web application contains three tag libraries:
/WEB-INF/tags/
/WEB-INF/tags/a.tag
/WEB-INF/tags/b.tag
/WEB-INF/tags/foo/
/WEB-INF/tags/foo/c.tag
/WEB-INF/tags/bar/baz/
/WEB-INF/tags/bar/baz/d.tag

Would you consider the above stmt as a typo ??? I think I see 4 tag files here: a.tag, b.tag, c.tag and d.tag

Now it wud be naive to think that the mention of 3 tag libraries in the spec is a typo but can anyone explain what does the spec mean by this ??
 
Chithra Salam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think its a typo.According to my understanding the spec means.

1) The jsp Container will look for a .tag file under WEB-INF/tag or any subdirectory of WEB-INF/tag.

2)We can have any number of subdirectories.These subdirectories are meant only for better organization of web application directories.There is no relation between the directories.Means they are just folders that give a better organization of files.

3)The Container will consider each subdirectory as an implicitly defined tag library containing tag handlers defined by the tag files Or other wise container will consider each subdirectory as seperate tag library.

Hence in the example we have 3 tag libraries and 4 tag file .
1) /WEB-INF/tags/ --> contain 2 tag files a.tag and b.tag
2)/WEB-INF/tags/foo -->contain 1 tag file c.tag
3)/WEB-INF/tags/bar/baz/ --> contain 1 tag file d.tag.

Chithra Salam.A
SCJP 85%,SCWCD-in Progress.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic