1、欢迎页设置 在web 文件夹下新建form.jsp : input 的类型是text,名字是:method。 一旦输入 add 或 delete 提交, 就会到HelloServlet进行跳转
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2023/3/20
Time: 20:42
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>New World</title>
</head>
<body>
<form action="/hello" method="post">
<input type="text" name="method">
<input type="submit">
</form>
</body>
</html>
2、在web.xml 做如下配置
<welcome-file-list>
<welcome-file>form.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
标签:03,20,form,SpringMVC,jsp,lesson01
From: https://www.cnblogs.com/RUI2022/p/17238257.html