多くのサーブレットの開発者は、 “ServletConfig”と “ServletContext”の違いについて混乱しています。実際には “ServletContext”という名前はかなり混乱しています。将来のリリースでは “AppConfig”または “AppContext”に変更する必要があります:)

ContextConfig

1)これは “Webアプリケーション” ** あたり1つです。すべてのサーブレットのクラスによってグローバルにアクセスできます2)web.xml – web-app要素内とサーブレット要素外

    <web-app ...>
        <servlet>
        <servlet-name>ServletName</servlet-name>
        <servlet-class>com.mkyong.ServletDemo</servlet-class>
    </servlet>

    <context-param>
            <param-name>email</param-name>
            <param-value>[email protected]</param-value>
    </context-param>
   </web-app>

3)サーブレットコード

getServletContext().getInitParameter("email")