IDEA里的web.xml页面的Servlet名称报错下方出现红色下划线
生活随笔
收集整理的這篇文章主要介紹了
IDEA里的web.xml页面的Servlet名称报错下方出现红色下划线
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
錯誤顯示
對于上述錯誤是因為只有新建的Servlet名稱但是并沒為為這個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><servlet-class>com.zsh.servlet.LoginServlet</servlet-class></servlet><servlet-mapping><servlet-name>LoginServlet</servlet-name><url-pattern>/LoginServlet</url-pattern></servlet-mapping></web-app>錯誤消失
總結
以上是生活随笔為你收集整理的IDEA里的web.xml页面的Servlet名称报错下方出现红色下划线的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++ queue和priority_q
- 下一篇: C语言数组元素的查询