web.xml详解

filter配置多个url-pattern的正确方式


    struts2
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


    struts2
    *.action


    struts2
    *.jsp

classpath与classpath*的区别


    contextConfigLocation
    classpath:/spring/*.xml

这种classpath配置是指只加载本地classpath路径下的spring文件夹中的以.xml结尾的文件。


    contextConfigLocation
    classpath*:/spring/*.xml

这种classpath*配置是指不仅加载本地classpath路径下的,而且也加载jar文件下的classpath路径下的spring文件夹中的以.xml结尾的文件。

配置load-on-startup的作用

在web.xml中配置servlet时有时需要配置load-on-startup这个属性,其作用是指在web容器启动时是否就加载该servlet,其值需为整数。当中的值大于等于0时,表示在容器启动时就加载,值越小,加载优先级越高;当小于0或者没有值时,表示在用到此servlet时才加载,不在启动时加载。

你可能感兴趣的:(web.xml详解)