【原文】http://www.cublog.cn/u/27731/showart_290196.html
config.getInitParameter(String name)
config.getInitParameterNames()
config.getServletName()
config.getServletContext()
实例:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>meg.jsp</title>
</head>
<body>
<table align="center" border="0" cellPadding="0" cellSpacing="0"
width="730">
<tr>
<td>
<div align="center">
<br>
客户服务信箱:
<%=config.getInitParameter("email")%>
客户服务热线:
<%=config.getInitParameter("phone")%>
<br>
客户服务 QQ:
<%=config.getInitParameter("qq")%>
<br>
</div>
</td>
</tr>
</table>
</body>
</html>
在web.xml的</web-app>前插入
<!-- config -->
<servlet>
<servlet-name>admin</servlet-name>
<jsp-file>/config.jsp</jsp-file>
<init-param>
<param-name>email</param-name>
<param-value>service@abc.com</param-value>
</init-param>
<init-param>
<param-name>phone</param-name>
<param-value>0411-12345678</param-value>
</init-param>
<init-param>
<param-name>qq</param-name>
<param-value>88888中文呢</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>admin</servlet-name>
<url-pattern>/config.jsp</url-pattern>
</servlet-mapping>
<!-- end config -->