import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; 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("/GetParameterNamesTest") public class GetParameterNamesTest extends HttpServlet { @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"); Enumeration params = (Enumeration)request.getParameterNames(); out.println(""); out.println(""); while(params.hasMoreElements()) { String name = params.nextElement(); String value = request.getParameter(name); out.printf("%n", name, value); } out.println("
NameValue
%s%s
"); out.println(""); out.close(); } }