getInitParameterNames()
返回值:儲存 JSP 中所有初始引數名稱的列舉物件。<% Enumeration names = config.getInitParameterNames(); while(names.hasMoreElements()){ out.println(names.nextElement()+"<br>"); } %>
<body> <% Enumeration ration = config.getInitParameterNames(); //返回servlet初始參數列 while(ration.hasMoreElements()){ //迴圈遍歷參數列 Object nameOb = ration.nextElement(); //獲取引數資訊 String name = (String)nameOb; out.println(name+":"); //輸出引數名 out.println(config.getInitParameter(name)+""); //輸出引數值 } %> <p>Web應用名稱</p> <%=config.getServletName()%> </body>