import javax.servlet.http.*; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); try { response.getWriter().println("Hello World!
"); } catch (IOException e) { e.printStackTrace(); } } }
import javax.servlet.http.*; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); response.setHeader("Pragma", "no-cache"); response.setHeader("Expires", "0"); try { response.getWriter().println("These examples use the javax.servlet.http package.Hello World!
"); } catch (IOException e) { e.printStackTrace(); } } }