public class S1 extends HttpServlet { private static final String CONTENT_TYPE = "text/html; charset=windows-1250"; // specifikacia charsetu response uzivatelovi //inicializacia globalnych nastaveni public void init(ServletConfig config) throws ServletException { } //spracovanie HTTP GET volania public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doService(request, response); } // spracovanie HTTP POST volania public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doService(request, response); } // implementacia oboch volani naraz public void doService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String p0 = request.getParameter("p"); if (p0 == null) { p0 = ""; } response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); out.println(""); out.println("S1"); out.println(""); out.println("

Tento servlet bol vyvolany metodou " + request.getMethod() + ". A toto je odpoved.

"); out.println("

parameter p ="+p0+"

"); out.println(""); } //uzavretie zdrojov public void destroy() { } }