close




To take advantage of the capabilities of modern browsers that use web standards,such as XHTML and CSS, your web application is being converted from simple JSP pages to JSP Document format. However, one of your JSPs, /scripts/screenFunctions.jsp, generates a JavaScript file. This file is included in several web forms to create screen-specific validation functions and are included in these pages with the following statement:

使用程式碼
10. <head>
11. <script src='/scripts/screenFunctions.jsp'
12. language='javascript'

13. type='application/javascript'> </script>
14. </head>

15. <!-- body of the web form -->

Which JSP code snippet declares that this JSP Document is a JavaScript file?
A. <%@ page contentType='application/javascript' %>
B. <jsp:page contentType='application/javascript' />
C. <jsp:document contentType='application/javascript' />
D. <jsp:directive.page contentType='application/javascript' />
E. No declaration is needed because the web form XHTML page already declares the MIME type of the
/scripts/screenFunctions.jsp file in the <script> tag.

Answer: D

說明:
         這題答案可選A、D,在題目說要JSP Document 。
         所以答案是D。


相關說明網站:
Page Directive
http://java.sun.com/products/jsp/syntax/1.2/syntaxref1210.html

The JSP page directive
http://www.servletworld.com/jsp-tutorials/jsp-page-directive.html



另說明:
來自
jsp:directive.page 與 import 的區別
http://hechuanzhen.iteye.com/blog/1546663

(以下說明,為轉貼)
jsp:directive.page 與 import 的區別
<jsp:directive.page import=“zero.space.ch03.BookBean”/>
相當予
<%@ page import="zero.space.ch03.BookBean" %>
 
 但是也有區別:
 兩個用法的作用范圍不同,
<%@ page import="zero.space.ch03.BookBean" %> 可用於多個頁面內而
<jsp:directive.page import="zero.space.ch03.BookBean"/>只能用於一個頁面,不能跨頁調用。
   例如:如果你把所有類別的引入放在一個JSP中,在其他jsp中用include引入那個jsp。
   這時引入類就必須採用
   <%@ page import="zero.space.ch03.BookBean" %> 這樣的寫法。
   <jsp:directive.page import="zero.space.ch03.BookBean"/>
   這種寫法只能在同一個jsp頁面中使用,不能跨頁週用...



JAVA_OCWCD






arrow
arrow
    文章標籤
    java jsp
    全站熱搜

    PG Levin Li 發表在 痞客邦 留言(0) 人氣()