import java.io.IOException; import java.io.PrintWriter; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @WebServlet("/Aisatsu") public class Aisatsu extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException ,IOException { response.sendRedirect("Aisatsu.html"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType( "text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); out.println(""); request.setCharacterEncoding("UTF-8"); String family = request.getParameter("family"); String given = request.getParameter("given"); out.printf("こんにちは, %s %s!%n", family, given); out.println(""); out.close(); } }