首页 > 技术文章 > Javaweb中请求的资源[/Servlet]不可用解决方案

1305536110-dym 2021-10-29 10:35 原文

问题描述:在提交form表单后报错servlet不可用

 

 解决方案:

我用的开发工具是idea2020,首先检查是否加了注解:

 

2.通过查阅资料都说要在web.xml下配置servlet,这里我一配置运行jsp出来网页源代码,也没有搞清楚为啥,以前的项目我也没有配置过web.xml

3.解决办法:在web.xml的web-app添加:

<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">

 

 至此,问题解决。

推荐阅读