web.xml中init-param的作用
定制初始化参数:可以定制servlet、JSP、Context的初始化参数,然后可以再servlet、JSP、Context中获取这些参数值。下面拿servlet来举例: < servlet > < servlet-name > dispatcherServlet </ servlet-name > < servlet-class > org.springframework.web.servlet.DispatcherServlet </ servlet-class > < init-param > < param-name > contextConfigLocation </ param-name > < param-value > classpath:springmvc.xml </ param-value > </ init-param > </ servlet > 经过上面的配置,在servlet中能够调用getServletConfig().getInitParameter(“contextConfigLocation”)获得参数名对应的值。 参考: https://www.cnblogs.com/fnlingnzb-learner/p/6560774.html 来源: CSDN 作者: yrk0556 链接: https://blog.csdn.net/yrk0556