close



Which implicit object is used in a JSP page to retrieve values associated with
<context-param> entries in the deployment descriptor?
A. config
B. request
C. session
D. application
Answer: D


web.xml裡面可以設定兩種參數:
Context初始參數 -- 使用(context-param)

Servlet初始參數 -- 使用(servlet-name)

(1)Context初始參數,是屬於web全堿變數,與JSP的application變數相同,在web.xml中配置如下:

<context-param>
           <param-name>test</param-name>
           <param-value>33</param-value>
  </context-param>


(2)Servlet初始參數,只屬於此servlet可以使用這變數,在web.xml中配置如下:

<servlet>
    ...
    <init-param>
       <param-name>paramTest1</param-name>
       <param-value>123</param-value>
    </init-param>

 </servlet>




相關資料:

 







arrow
arrow
    文章標籤
    java ocwcd scwcd
    全站熱搜

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