IDEA 2022.3.3 + tomcat-9.0.27
Java EE8 + JDK-16
配置访问的虚拟路径
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<servlet>
<servlet-name>firstDemo</servlet-name>
<servlet-class>com.study.ServletDemo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>firstDemo</servlet-name>
<url-pattern>/good</url-pattern>
</servlet-mapping>
</web-app>
效果演示