标签:style blog color ar 文件 div sp log on
一、得到ServletContext的方法
ServletContext context = this.getServletContext();
二、用途:通过context的getInitParameter()方法获取web.XML中配置的参数
XML文件:
<context-param> <param-name>邮箱</param-name> <param-value>434507250</param-value> </context-param> <context-param> <param-name>电话号码</param-name> <param-value>18381330428</param-value> </context-param>
Servlet源文件:
ServletContext context = this.getServletContext(); String email = context.getInitParameter("邮箱"); String tel = context.getInitParameter("电话号码");
标签:style blog color ar 文件 div sp log on
原文地址:http://www.cnblogs.com/SkyGood/p/3959169.html