JSP自定義標簽由淺到深詳細講解(二)

發表于:2008-10-08來源:作者:點擊數: 標簽:jspJSPJsp講解定義
關鍵字: 十一、ServletContext類的常用API: 1.getContext(String uripath):返回 服務器 中uripath所代表的ServletContext對象 2.getInitParameter(String name):返回ServletConfig對象中name參數的值 3.getMineType(String file):返回file參數代表的文
關鍵字:


十一、ServletContext類的常用API:


1.getContext(String uripath):返回服務器中uripath所代表的ServletContext對象


2.getInitParameter(String name):返回ServletConfig對象中name參數的值


3.getMineType(String file):返回file參數代表的文件的MIME類型


4.getRequestDispatcher(String path):返回path代表的RequestDispacher對象


5.getResourceAsStream(String path):以輸入流的形式返回path對應的資源,在輸入留中對象可以為任意形式的數據,path參數必須以“/”開始且相對于Context Root


十二、如何使用ServletContxt讀取并保存屬性文件:


1.創建java.util.Properties類對象


2.獲取ServletContext對象


3.將屬性文件以輸入流的形式讀入到某個輸入流對象中


4.將輸入流對象加載到Properties對象中


5.將Properties對象保存到ServletContext對象中


十三、如何在Web應用啟動時裝載靜態文本:


1.創建繼承了HttpServlet類的子類,在web.xml中配置這Servlet時設置load-on-startup屬性:


someclass

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97