简体   繁体   English

简单的html形式..操作字段未执行

[英]Simple html form.. action field not being executed

I have a simple html form (first name and last name) once I hit submit it should give me a simple response from my java servlet that says "Hello plus first name plus last name" 我有一个简单的html表单(名字和姓氏),一旦我点击了提交,它应该给我一个来自Java servlet的简单响应,上面写着“你好,名字加姓氏”。

I ran this using eclipse and a tomcat plugin and it works perfectly.. but when I create a war file and deploy it from tomcat.. I get the first screen.. enter first and last name.. but when I hit submit, it looks for "WelcomeScreen" nowhere in my code do i have "welcomeScreen" Below is my HTML code. 我使用eclipse和tomcat插件运行了它,它运行完美。.但是当我创建一个war文件并从tomcat部署它时。.我得到了第一个屏幕..输入名字和姓氏..但是当我点击提交时,它我的代码中无处查找“ WelcomeScreen”,我没有“ welcomeScreen”。这是我的HTML代码。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Please enter your name</title>
</head>
<body>
    <form name="input" action=Hello method="get">
        First name: <input type="text" name="firstname"><br> Last
        name: <input type="text" name="lastname"> <input type="submit"
            value="Submit">
    </form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Please enter your name</title>
</head>
<body>
    <form name="input" action="Hello.html" method="get">
        First name: <input type="text" name="firstname" /><br> 
        Last name: <input type="text" name="lastname" />
        <input type="submit" value="Submit" />
    </form>
</body>
</html>

I wrote correct code. 我写了正确的代码。 There were some mistakes in html like; html中有一些错误,例如;

<form name="input" action=Hello method="get"> 
<!-- You've forgotten quotes -->
<!-- And also dont forget to write ".html" or Hello controller in framework like MVC -->
<form name="input" action="Hello.html" method="get">

Another one 另一个

<input type="text" name="firstname">
<!-- You've forgotten /// -->
<input type="text" name="firstname" />

And your Hello.html 还有你的Hello.html

<html>
<head>
    <title>Title</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <script type="text/javascript">
        var get = window.location.search.replace( "?", "" );
        alert(get);
    </script>
</head>
<body>
    <div>Content</div>
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM