[英]Simple html form.. action field not being executed
我有一个简单的html表单(名字和姓氏),一旦我点击了提交,它应该给我一个来自Java servlet的简单响应,上面写着“你好,名字加姓氏”。
我使用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>
我写了正确的代码。 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">
另一个
<input type="text" name="firstname">
<!-- You've forgotten /// -->
<input type="text" name="firstname" />
还有你的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.