The requested resource [/servlet] in JavaWeb is not available [How to Solve]

Problem Description: after submitting the form, an error is reported, and the servlet is unavailable

Solution:

The development tool I use is idea2020. First, check whether comments are added:

2. Through consulting materials, it is said that servlets should be configured under web.xml. Here, I run JSP to get the web page source code, but I don’t know why. I haven’t configured web.xml in previous projects

3. Solution: add the following in the web app of web.xml:

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

So far, the problem has been solved.

Similar Posts: