Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Servlet映射中的无效内容在哪里_Java_Servlets_Jakarta Ee - Fatal编程技术网

Java Servlet映射中的无效内容在哪里

Java Servlet映射中的无效内容在哪里,java,servlets,jakarta-ee,Java,Servlets,Jakarta Ee,为无效的url模式获取以下erorr。试图完全按照Telusko的教程进行操作 我表单中的action属性设置为“add”,我尝试过使用或不使用正斜杠,但都没有成功。请帮忙。多谢各位 cvc-complex-type.2.4.a: Invalid content was found starting with element 'servlet-mapping'. One of '{"http:// xmlns.jcp.org/xml/ns/javaee":url-pattern}' is ex

为无效的url模式获取以下erorr。试图完全按照Telusko的教程进行操作

我表单中的action属性设置为“add”,我尝试过使用或不使用正斜杠,但都没有成功。请帮忙。多谢各位

cvc-complex-type.2.4.a: Invalid content was found starting with element 'servlet-mapping'. One of '{"http://
 xmlns.jcp.org/xml/ns/javaee":url-pattern}' is expected.
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

<servlet>
    <servlet-name>abc</servlet-name>
    <servlet-class>com.centeno.AddServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>abc</servlet-name>
    <servlet-mapping>/add</servlet-mapping>
</servlet-mapping>

</web-app>

abc
com.centeno.AddServlet
abc
/加

尝试url模式,而不是servlet映射内部标记servlet映射

    <servlet-mapping>
        <servlet-name></servlet-name>
        <url-pattern></url-pattern>
    </servlet-mapping>