import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.Enumeration; public class ServletPost2 extends HttpServlet{ public void doPost(HttpServletRequest kysimus, HttpServletResponse vastus)throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=vastus.getWriter(); Enumeration parameetrid=kysimus.getParameterNames(); while(parameetrid.hasMoreElements()){ String parameetriNimi=(String)parameetrid.nextElement(); valja.println(parameetriNimi+" = "+kysimus.getParameter(parameetriNimi)+"\n"); } valja.println(); Enumeration teated=kysimus.getHeaderNames(); while(teated.hasMoreElements()){ String teateNimi=(String)teated.nextElement(); valja.println(teateNimi+" - "+kysimus.getHeader(teateNimi)+"\n"); } } public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus)throws IOException, ServletException{ doPost(kysimus, vastus); } }