{ doGet( request, response ) ; }} The above servlet is as bare bones as it gets. It is important to note that you do not have to override the doGet or doPost methods if you instead override the service method and handle all requests there. This would not be considered good form in servlet design, but it is an option. In the next section we will see that a minimal JSP-generated servlet is a bit different since the doGet and doPost methods do not exist. Writing a Minimal JSP-Generated Servlet The nuts and bolts of a JSP-generated servlet are dependent on the JSP-to-servlet translator used with a particular Web server. Listing 8-2 shows a rather simple JSP page in which Tomcat 3.2 generated the servlet. However, this page is not the simplest because it has actual JSP scripting elements a simple page would have nothing but static text. Listing 8-2: A simple JSP page with a couple of scripting elements Minimal JSP Page
<%! String hello = "Hello World"; %> <%= hello %>