Html 动作元素不工作

Html action Element not working

我有两个文件。一个是 form.html 另一个是 form2.jsp

我想在 form.html 中使用表单操作元素来处理 form2.jsp,但是在 form.html 中单击提交后,操作元素不起作用。这两个文件都在同一目录中,即 webapplication 中的 WebContent 文件夹。

<!DOCTYPE html>
<html>
   <head>
      <meta charset="ISO-8859-1">
      <title>Registration Form</title>
   </head>
   <body>
      <form name="form" action="form2.jsp" method="get">
         First Name : <input type="text" name="fname">
         Last Name : <input type="text" name="lname">
         <input type ="button" value="Submit" />
      </form>
   </body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Insert title here</title>
   </head>
   <body>
      <%
         out.println("Hello from form2'");
      %>
   </body>
</html>

改变这个,

<input type ="button" value="Submit" />

<input type ="submit" value="Submit" />

或与

<button type="submit">Submit</Button>