• web.xml在Servlet3.0中的新增元素


    metadata-complete:

    当属性为true时,该Web应用将不会加载注解配置的Web组件(如Servlet、Filter、Listener)

    当属性为false时,将加载注解配置的Web组件(如Servlet、Filter、Listener).

    注意:如果在为true时,且在Web.xml中配置了注解,程序在编译时会报错,只需变更此参数为false即可。

            在Servlet3.0的注解中,对应Servlet的启动顺序问题。解决方法:启用load-on-startup,如@WebServlet(load-on-startup=1)

            //整数小的在Web应用启动时立即优先实例化,不设定则在客户端第一次请求此servlet时时行实例化。

    例:参看配置头文件(如下)

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
     id="WebApp_ID" version="3.1" metadata-complete="false">
     <display-name>PFAPP</display-name>
     <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
     </welcome-file-list>
    </web-app>

  • 相关阅读:
    git ssh keys
    git 修改 email
    git 撤销commit
    企微调试模式
    ORACLE 根据某个字段固定值进行分区
    Apache FtpClient login失败
    Oracle序列
    Oracle merage into
    Oracle all_tables 以及常用sql
    性能优化-使用高性能的库fastutil
  • 原文地址:https://www.cnblogs.com/flycatnet/p/5122401.html
Copyright © 2020-2023  润新知