This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Mock Exam

 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given:
1. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/
jstl/core" %>
2. <%@ taglib prefix="tables" uri="http://www.javaranch.
com/tables" %>
3. <%@ taglib prefix="jsp" tagdir="/WEB-INF/tags" %>
4. <%@ taglib uri="UtilityFunctions" prefix="util" %>
What about the above taglib directives would cause the JSP to not function?
A. Line 4 is wrong because the prefix attribute must come before the
uri attribute.
B. Line 3 is wrong because there is no uri attribute.
C. Line 4 is wrong because the uri value must begin with http://
D. Line 3 is wrong because the prefix jsp is reserved for standard actions.

Correct answer: C. I think option C is wrong and right answer should be option D. Help me to find the correct answer.

Srividhya
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that it cannot be C. D looks like the only answer.
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks christophe. These questions are from HFSJ mock exam 2nd edition. Is there any errata for this edition.

And I have a doubt in a topic not related to this post. Can a request dispatcher be used to forward a request to a file in another web application. I am taking my exam tomorrow so in a hurry. Sorry.

Srividhya
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Errata
 
Paul Brabban
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srividhya

From Javadocs for ServletRequest interface:

The pathname specified may be relative, although it cannot extend outside the current servlet context. If the path begins with a "/" it is interpreted as relative to the current context root. This method returns null if the servlet container cannot return a RequestDispatcher.

So no, request dispatcher can only dispatch relative to the context root.

Good luck in your exam!

Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic