JSP config. Getinitparameternames() method: get the names of all initial parameters

getInitParameterNames()

Example

<%
  Enumeration names = config.getInitParameterNames();
  while(names.hasMoreElements()){
  out.println(names.nextElement()+"<br>");
  }
%>

Typical application

<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>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>