Pauline wants to use JSPs in her web apps—she’s really sick of writing HTML into a servlet’s PrintWriter println().
She decides to learn JSPs by making a simple dynamic page that prints the number of times the page has been requested. She understands that you can put regular old Java code in a JSP using a scriptlet—which just means Java code within a <% ... %> tag.
BasicCounter.jsp
Counter.java
package foo; public class Counter { private static int count; public static synchronized int getCount() { count++; return count; } }