Chapter 9. A Small Cup of Java
At many points throughout this book, examples could be discussed only so far before running into a boundary. Those boundaries were frequently demarcated by the transition from the view into the model, but the real issue is that on one side of this boundary lives the JSP code and on the other side the unexplored territory of Java code.
In part, this division has been made deliberately; one of the impetuses for the creation of JSPs and for separating working into a model part and a view part was to allow page authors to create interactive, dynamic Web sites without needing to know any Java. But in another sense, all divisions between knowledge are arbitrary, and page authors could benefit from knowing at least some Java.
To those who have never programmed before, programming may seem like a mystical black art, beyond the ken of mere mortals. OK, it may be a bit spooky, but there is no reason why everyone cannot learn to program. This chapter will not teach programming; nor will it completely cover the Java language. Many good books will do this, including Introduction to Programming Using Java: An Object-Oriented Approach, Java 2 Update by David Arnow and Gerald Weiss and The Java™ Tutorial, Third Edition: A Short Course on the Basics by Mary Campione, Kathy Walrath, and Alison Huml (Pearson Education, 2001). A number of colleges and training centers offer courses in Java for programmers and nonprogrammers.
This chapter will also not explain how to use Tomcat or any other development environment. See the documentation for the relevant product for this information or the accompanying CD-ROM for information on setting up Tomcat.
What this chapter will do is introduce enough Java basics to follow the code that appears throughout the subsequent chapters. These basics should also be as much Java as most JSP authors will ever need, although, of course, it is never a bad idea to know more. Learning to program in Java will enable JSP authors to create new beans and other utility classes, as well as write servlets instead of JSPs when appropriate.
|