getServletContext().getInitParameter(“参数名称”)----从web.xml读取参数名,是全局的参数名。
顺便说一下getServletConfig 和getServletContext的区别
getServletConfig仅适用于servlet,体现在获取web.xml下servlet的参数。<servlet> <init-param></servlet> , getServletConfig拥有ServletContext的引用,getServletContext,所以可以操作servletContext相关的东西
getServletContext是web级别上下文,可以获得系统绝对路径:.getRealPath("/") 或者获得xml的内容 getResource("WEB-INF/config.xml"),它的getInitParameter函数是获取web.xml的全局参数的值也就是用<context-param>标识的参数
System.getProperty(参数名称) 获取jvm参数的值。