• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do we always need an entry for taglib in the web.xml?

 
Thambi Rajah
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across the following question and puzzled with the answer.
***********************************************
Which of the following following statements is true?
(A) The JSP page must include a taglib element to identify which tag libraries to load into memory.
(B) The web.xml document must use a taglib element to identify the location of the TLD file.
(C) The TLD file must use the taglib element to identify each custom tag and its attributes.
(D) All of the above.
The answer on Mock exam says: (D)
***********************************************
I will go for the answers (A) and (C).
Would somebody explain why (B) is also true.
Thanks in advance,
Thambi
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because taglib is in the DTD for element web-app (file web.xml). However, if you DON'T use any custom tag library in the web application, then it doesn't have to appear.
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I feel even A is wrong. We specify taglib directive not to load the taglib into memory. We give reference to the already loaded tag library.
There may not be any need to specify the taglib in web.xml if we dont want to specify any custom uri to the taglib.

Raj Paul
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Thambi Rajah:
(C) The TLD file must use the taglib element to identify each custom tag and its attributes.

In fact, (C) is a little strange too since you describe each custom tag and its attributes with the tag element, not the taglib element.
Simon
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get the question, all answers are wrong since they all have a "must" inside. Nothing is "must" here.
 
Thambi Rajah
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the question I posted created confusion to many people, I provide the origin of
the question.
Book Name: Java 2 Web Developer Certification Study Guide
Authors: Natalie Levi with Philip Heller
Publisher: SYBEX
Exam Name: Assessment Test
Question Number: 20
Thank You,
Thambi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic