CHAPTER 2: Building Web Applications Using Servlets and JSP 71
For more information on the Java Servlet technology, refer to the Java Servlet 3.1 specification^2 and
the Java Servlet web site.^3
Java Server Pages
Servlets enable the web server to generate dynamic content. However, servlets have one major
disadvantage in that the HTML code is required to be hardwired in the Java code. To eliminate
this cross-cutting of concerns, the Java Server Pages (JSP) technology was created. JSP uses a
combination of static HTML content and dynamic content to generate web pages, thus separating
the concern of embedding HTML content in Java code.
Your First Web Application Using JSP
Now you will create a “Hello World” application using JSP. Since you created a project with this
name earlier, make sure to delete or rename the old project first. Then right-click in the project
explorer and select Dynamic Web Project, as shown in Figure 2-22. Name the project helloworld.
Figure 2-21. Accessing the application
(^2) http://jcp.org/en/jsr/detail?id=340
(^3) http://www.oracle.com/technetwork/java/index-jsp-135475.html
Figure 2-21 shows the output.