wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ final mock exam quetion 54 - taglib and uri Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ final mock exam quetion 54 - taglib and uri" Watch "HFSJ final mock exam quetion 54 - taglib and uri" New topic
Author

HFSJ final mock exam quetion 54 - taglib and uri

Adrian Sosialuk
Ranch Hand

Joined: Jun 07, 2007
Posts: 57
Hi everybody,

Given a tag library descriptor located at /mywebapp/WEB-INF/tlds/mytags.tld,
which would be the correct taglib directive ? Assume 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" %>
E) /mywebapp/WEB-INF/tlds/mytags.tld is NOT a valid location
for a tag library descriptor, so none of these will work.

The correct answer according to the HFSJ is C stating:

Option C is correct because, in the absence of a <taglib> element
in the DD, the URI must be a full path relative to the application root.

I really don't understand it. Earlier you can read that URI is not
a real path to the tld file and now they write it is. You don't have to
write any <taglib> elements in the DD and it will still work (assuming
there is a tld with matching URI whatever it is and it's in the default
location). Is it a mistake ?

Cheers,

Adrian.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

This is a confusing question. The author replied in this thread.


[My Blog]
All roads lead to JavaRanch
Adrian Sosialuk
Ranch Hand

Joined: Jun 07, 2007
Posts: 57
Hi Christophe,

Thanks for your reply.

Yes - I looked through JSP spec and IMHO the question is
wrongly formed.

1) First of all, you don't have to use taglib element in DD at all
2) The important thing is that URI matches, no matter what it is.
So even though you don't have the taglib element in the DD, it doesn't
have to be path.
3) And here the thing that I don't quite understand - you can provide
path to the existing tld file which will work, but why would anybody
do that ? I mean you have to provide URI or path anyway, so unless
someone is lazy and have URI longer than path then that's the only
reason I can see of using that ...


Cheers,

Adrian
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

3) And here the thing that I don't quite understand - you can provide
path to the existing tld file which will work, but why would anybody
do that ?

Using the path is actually useful when using Tag Files, as you don't need to provide a TLD (which means there's no uri either).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ final mock exam quetion 54 - taglib and uri