This is my folder structure:
Servletdemo1 code is as follows:
Package com. Wx. Servlet.
The import javax.mail. Servlet. ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
The import javax.mail. Servlet. HTTP. It;
The import javax.mail. Servlet. HTTP. HttpServletResponse;
import java.io.IOException;
@ WebServlet (name="Servletdemo1")
Public class Servletdemo1 extends the HttpServlet {
Protected void doPost (it request, HttpServletResponse response) throws ServletException, IOException {
}
Protected void doGet (it request, HttpServletResponse response) throws ServletException, IOException {
//to redirect
The response. SendRedirect ("./jspdemo1/not JSP ");
}
}
The JSP page code is as follows:
<% -- --
Created by IntelliJ IDEA.
User: W
Date: 2020/6/11
Time:
"To change this template use File | Settings | File Templates.
- % & gt;
<% @ page contentType="text/HTML. Charset=utf-8 "language=" Java "% & gt;
Jspdemo1 & lt;/title>
<body>After the jump page!