code033.jsp
<%@page import="java.util.Enumeration"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>获取web.xml中的配置</title>
</head>
<body>
<%
Enumeration enumeration1 = application.getInitParameterNames();
while(enumeration1.hasMoreElements())
{
String name = enumeration1.nextElement().toString();
String value = application.getInitParameter(name);
out.println(name + ":");
out.println(value);
}
%>
<%--
在tomcat的web.xml配置文件中,增加如下配置:
<context-param>
<param-name>url</param-name>
<param-value>jdbc:mysql://127.0.0.1:3306/test</param-value>
</context-param>
</web-app>
--%>
</body>
</html>