Select and use on servlet-api.jar and jsp-api.jar of

Choose which relies

Under javax packages are jdk provide interface specifications, to achieve their own server by third-party vendors.
jsp-api dependency occurs as a secondary migration:
javax.servlet.jsp-API ==> javax.servlet.jsp.jsp-API ==> javax.servlet.jsp.javax.servlet.jsp-API
so the latest jsp dependencies should be javax.servlet.jsp.javax.servlet.jsp-api.
Similarly, servlet-api-dependent migration also took place as follows:
javax.servlet.Servlet-API ==> javax.servlet.javax.servlet-API
If we migrate or abandoned, please maven central repository to view changes.

Such dependency in Maven introduced into two:

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <javax.servlet-api.version>4.0.1</javax.servlet-api.version> // 请自行选择最新版本号
    <javax.servlet.jsp-api.version>2.3.3</javax.servlet.jsp-api.version>
  </properties>
<dependencies>
  <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>${javax.servlet-api.version}</version>
      <scope>provided</scope>
    </dependency>
  <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>${javax.servlet.jsp-api.version}</version>
      <scope>provided</scope> 
  </dependency>
</dependencies>

<scope>provided</scope>Indicates that the scope is providedadded to the list, i.e. only at compile, test environment, re-running the package dependencies (for example, JDK or a container such as Tomcat) provided, no repacking (jar / war), and otherwise will runtime package conflicts.

Other Reading

https://www.cnblogs.com/douJiangYouTiao888/p/6473879.html

Guess you like

Origin www.cnblogs.com/xsjzhao/p/11024528.html