【发布时间】:2022-01-30 05:15:39
【问题描述】:
我正在编写一个简单的 Web 服务,并将我的 web.xml 文件放在 WEB-INF 文件夹中。出于某种原因,servlet-class 标记中的所有内容都显示为 “无法解析 MyServlet 类”。 MyServlet 类位于根目录下的 src 文件夹中。我不知道为什么会发生这种情况。
<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_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/my/*</url-pattern>
</servlet-mapping>
【问题讨论】:
标签: java xml intellij-idea servlets web.xml