Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EPractice Lab mock exam 5 <> vs <%@page>  RSS feed

Ranch Hand
Posts: 1684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A developer wants to convert Arabic characters to Unicode in JSP page. This file is
incoudes in several JSP files to convert unicode functions and are included in these pages
with the following statement:
<script src='/js/unicodeHandler.jsp' language='javascript' type='application/javascript'>

Which JSP code snippet declares that unicodeHandler.js is a JavaScript file?
a. <%@page contentType="application/javascript"%>
b. <jsp:page contentType='application/javascript'/>
c. <jsp:document contentType="application/javascript"/>
d. < contentType="application/javascript"/>

Given answer is D.
The <%@page %> directive applies to an entire JSP file and any of its static include files, which
together are called a translation unit. A static include file is a file whose content becomes part of
the calling JSP file. The <%@page%> directive does not apply to any dynamic include files.
The attribute contentType is used to specify the MIME type and character encoding the JSP file uses for the response
it sends to the client. We can use any MIME type or character set that are valid for the JSP container.
The default MIME type is text/html, and the default character set is ISO-8859-1.

I think the answer should be A and D because <%@page %> and <> is equivalent.
Danger, 10,000 volts, very electic .... tiny ad:
Rocket Oven Kickstarter - from the trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!