Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdiscuss mock exam question

 
Divya Guttikonda
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a mock exam question from JDiscuss.
Q : You are working with a tag library which is packaged in a jar file named htmlutil.jar. This jar file also contains a META-INF/htmlutil.tld file which has a uri element as follows:

<uri>http://www.xyzcorp.com/htmlLib</uri>

What can you do to access this library from your JSP pages?

a)You must define the <taglib> element in the web.xml to specify the mapping for <taglib-uri> to the location of this jar file.

b)There is no need for the <taglib> element in the web.xml, however, you need the taglib directive in the JSP pages.

c)You can directly access the tags of this library from the JSP pages without any taglib directive.

d)You do not need the taglib directive, but you do need to specify the <taglib> element in the web.xml.

e)None of these.
The answer given is (b) but i think the answer is (a).Can anybody throw some light?

Thanks
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

According to JSP 2.0 specs, there is no need to define the taglib element in web.xml. The container implicitly add all the entries in the .tld files in WEB-INF of application and META-INF if jar files in WEB-INF\lib\ directory for the tags.

We always require the taglib directive in jsp file to assign the prefix to use the tag.

So the answer B is correct.

Thanks
 
Divya Guttikonda
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for the reply.I got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic