<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # JSP 中的`config`隱式對象 > 原文: [https://beginnersbook.com/2013/11/jsp-implicit-object-config-with-examples/](https://beginnersbook.com/2013/11/jsp-implicit-object-config-with-examples/) 它是`javax.servlet.ServletConfig`的一個實例。`Config`隱式對象用于獲取特定 JSP 頁面的配置信息。使用`application`隱式對象,我們可以獲得應用范圍的初始化參數,但是使用`Config`我們可以獲得單個 servlet 映射的初始化參數。 ### `config`隱式對象的方法 1. `String getInitParameter(String paramname)` - 與我們在`application`隱式對象教程中討論的相同。 2. `Enumeration getInitParameterNames()` - 返回`Initialization`參數的枚舉。 3. `ServletContext getServletContext()` - 此方法返回對 Servlet 上下文的引用。 4. `String getServletName()` - 它返回我們在`<servlet-name>`里面的`web.xml`文件中定義的 servlet 的名稱。標簽。 **`config`隱式對象示例** `web.xml` 讓我們說下面是我的`web.xml`文件。我只是在其中定義 servlet 名稱和 servlet 映射。稍后,我將使用`config`隱式對象從該文件中獲取一些細節。 ```html <web-app> <servlet> <servlet-name>BeginnersBookServlet</servlet-name> <jsp-file>/index.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>BeginnersBookServlet</servlet-name> <url-pattern>/index</url-pattern> </servlet-mapping> </web-app> ``` `index.jsp` 在這個 JSP 頁面中,我們調用`config`對象的`getServletName()`方法,用于從`web.xml`文件中獲取 servlet 名稱。 ```html <html> <head> <title> Config Implicit Object</title> </head> <body> <% String sname=config.getServletName(); out.print("Servlet Name is: "+sname); %> </body> </html> ``` **輸出:** 這是上述 JSP 頁面的輸出屏幕。 ![config](https://img.kancloud.cn/a5/92/a592e738e8399688c01435a49d4a8c8c_503x243.jpg) 這就是`config`隱式對象的全部內容。如果您有任何問題,請隨時在下面發表評論。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看