• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Mock question

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic