• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uri

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following taglib definition in the deployment descriptor. Which of the following directives can be used inside a JSP page?
1. <% taglib name="/tableutils" prefix="u" %>
2. <%@ taglib uri="tableutils" prefix="u" %>
3. <%@ taglib uri="/tableutils" prefix="u" %>
4. <%@ taglib="/utils" prefix="u" %>
5. <%@ taglib url="/tableutils" prefix="u" %>


Answer 3 is correct.
Answer 1 is incorrect, the attribute name is invalid with the taglib directive and the directive is incorrectly declared (<% instead of <%@)
Answer 2 is incorrect, the URL within the uri attribute has to be relative according to the web.xml declaration.
Answer 4 is incorrect, the URL is incorrect.
Answer 5 is incorrect, the url attribute is invalid for the taglib directive.

The taglib directive in a JSP page declares that the page uses a tag library, uniquely identifies the tag library using a URI and associates a tag prefix that will distinguish usage of the actions in the library.

--------
I don't understand the question.. In HFS it says, that URI is just a name & not a location & the explaining given is ....??/ please help
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i forgot to add the dd tags

<taglib> <taglib-uri>/tableutils</taglib-uri> <taglib-location>/WEB-INF/tld/utils.tld</taglib-location></taglib>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which one don't you understand ? Number 2 ?

It says : the URL within the uri attribute has to be relative according to the web.xml declaration.
It's a bit awkward to say it this way indeed. The uri in web.xml starts with a slash, whereas the one in answer two doesn't. As you said, uri is just a name, so it has to match the one you have in web.xml.
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this is the reason my answer was correct. But my question was that..the explaning given was not in any way mentioning the concept given in HFS..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think it's misleading too. I think that the answer should be something like : "Wrong. The uri should be the same as the one declared in web.xml".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic