• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URI question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HF book on page 789, the mock exam 54)

Given the library descriptor located at /mywebapp/WEB-INF/tlds/mytags.tld, which would be the correct taglib directive? Asume mywebapp is the web application root and that there are no <taglib> tags in the deployment descriptor.

a) <%@ taglib uri = "/mytags.tld" prefix = "my" %>
b) <%@ taglib uri = "/tlds/mytags.tld" prefix = "my" %>
c) <%@ taglib uri = "/WEB-INF/tlds/mytags.tld" prefix = "my" %>
d) <%@ taglib uri = "/mywebapp/WEB-INF/tlds/mytags.tld" prefix = "my" %>

Book says the correct answer is c), and the book explains that if you don�t put <taglib> in DD, the uri in a taglib directive in JSP must be a full path relative to the application root.

I am confused. I though the correct answers are all of them (as long as the TLD file has corresponding <uri> )...
The new (JSP2.0) way is the Container automatically maps a taglib uri to a TLD and you don't have to specify <taglib> in DD.

Anyone can explain ?
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But its not mentioned in the question that tld file has a uri attribute in it.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my understanding, the uri in taglib directive should match with the uri element in the TLD. If the question didn't specify the TLD's uri value, you will consider the relative path to the tld starting from the Document root.
 
I am Arthur, King of the Britons. And this is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic