Two Laptop Bag*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mock question" Watch "Mock question" New topic
Author

Mock question

Selva Prasad Rajendran
Ranch Hand

Joined: Sep 07, 2004
Posts: 38
Which of the following statements are true about the taglib directive? [Check all correct answers]

1. The uri element can only contain an absolute URI that identifies a tag library.



2. The uri element can only contain a relative URI that identifies a tag library.



3. The prefix element indicates a unique string.



4. The following prefixes cannot be used: java,servlet and sun.



5. If the uri contains an absolute path to a jar file then all handler classes should be included in the jar file and cannot be defined in the web-application classpath.


The Answer is given as

Answer 3, 4 and 5 are correct.
Answer 1 and 2 are incorrect, the uri elements can contain an absolute or relative path that identifies the tag library descriptor.
Answer 3 is correct, the unique string is used in the <prefix:tagname> declaration.
Answer 4 is correct, the following prefixes are reserved and cannot be used: jsp, jspx, java, javax, servlet, sun and sunw.
Answer 5 is correct, all classes and TLD file must be located in the Jar file.



-----------------------------------------

Can any one tell is the option 5 is true.

if the uri contains the absolute path to the jar is that it is neccessary to have handler classes to be inside the jar


-selva
chris noe
Greenhorn

Joined: Aug 20, 2003
Posts: 14
I think 5 is not correct.
The uri is only a string to map a location.
There is no link between the uri and the location.
The tld must be under the WEB-INF or if in a jar, it should be under the
META-INF directory. That is where the container looks to create his taglib-map that contains the all the uri-location of the tld's.

where did you find this question ?

Grtz,
Chris.
Selva Prasad Rajendran
Ranch Hand

Joined: Sep 07, 2004
Posts: 38
hi chris,

i found this question in j2eecertificate.com. I read that the TLD's must be some where under WEB-INF or sub directore of WEB-INF . If deployed in a JAR then it must be under META-INF or Subdirectory of META-INF

and Tag Handler classes or any classes must be inside WEB-INF/classes in a directory structure matching the package or in the appropriate package directory with in the a JAR inside WEB-INF/lib.

but is that necessary that the Tag Handler class should be inside the JAR file when the tld is in the META-INF folder of the JAR.

-Selva
SCJP 1.4
chris noe
Greenhorn

Joined: Aug 20, 2003
Posts: 14
Selva,

This is my own interpretation, but i wouldn't think so.
If the container can find the tld, it knows where to find the class (<tag-class> in the tld). Wether the class is located in the jar or in the classes dir makes no difference. It uses the classpath to find the class, and both (web-inf/classes and jar files) are autmatically put in the path when the container starts up.
 
GeeCON Prague 2014
 
subject: Mock question