Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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
在将表单填写到HelloWorld.java后,我的html表单没有被重定向?_Java_Html_Forms_Servlets_Intellij Idea - Fatal编程技术网

在将表单填写到HelloWorld.java后,我的html表单没有被重定向?

在将表单填写到HelloWorld.java后,我的html表单没有被重定向?,java,html,forms,servlets,intellij-idea,Java,Html,Forms,Servlets,Intellij Idea,我是JavaEE的初学者,我使用intellij idea作为IDE,并将表单转换为html,如下所示: 这是我的Hello.html: <!DOCTYPE html> <html> <body> <form action="HelloWorld" method="POST"> First name: <input type="text" name="first_name"> last name: <input t

我是JavaEE的初学者,我使用intellij idea作为IDE,并将表单转换为html,如下所示:

这是我的
Hello.html

<!DOCTYPE html>
<html>
<body>
<form action="HelloWorld" method="POST">
    First name: <input type="text" name="first_name">
    last name: <input type="text" name="last_name">
    <input type="submit"  value="Submit">
</form>
</body>
</html>
这是我的
web.xml
文件:

<?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_3_1.xsd"
         version="3.1">

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>

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

</web-app>

你好世界
你好世界
你好世界
/地狱世界
现在,当我运行我的
HelloWorld.java
时,它成功运行,但当与表单一起运行时,它不会运行,我的意思是,当我运行
Hello.html
时,它以正确的方式显示表单,但当我在单击提交后填写名称时,它会显示错误消息,请查看我的。 我用正确的方法开始了我的程序,它工作正常,在运行
HelloWorld.java
之后,我使用
http://localhost:8888/HelloWorld?first_name=Raj&last_name=Arora
它成功地显示了名称,但默认情况下,usign
Hello.html
会显示错误消息。。。请帮忙


请帮忙

您尚未指定helloworld文件的扩展名。它应该是helloworld.java。还要从标题标记中删除分号“;”。您收到错误“filenotfound”,只是因为您没有为helloworld提供扩展名。

在浏览器上发布表单的html生成代码。。正如您所说,我只做了,但没有工作人员:(我想您正在通过
http://localhost:8888/HelloWorld
最后我解决了我的问题,因此我考虑给出我自己的答案,最后我的程序开始运行。谢谢大家,这里是解决方案。请给出你自己的答案
<?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_3_1.xsd"
         version="3.1">

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>

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

</web-app>