Advertisement

在IDEA中,位于web.xml页面上的Servlet命名异常提示部分用红色标注显示

阅读量:

错误显示

在这里插入图片描述

上述错误的出现原因在于,虽然创建了新的Servlet类,但未为其配置对应的访问路径及URL映射关系。要解决该问题,只需为该Servlet添加相应的访问路径和映射设置即可。

修改之后的代码

复制代码
    <?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>LoginServlet</servlet-name>
        <ser

全部评论 (0)

还没有任何评论哟~