I use this blog as a soap box to preach (ahem... to talk :-) about subjects that interest me.

Tuesday, August 3, 2010

Web Development for All

What follows is the presentation of my book "Beginning JSP™, JSF™ and Tomcat™ Web Development: From Novice to Professional" (see sidebar) that I wrote for the website of the Italian Scientific Attaché in Canberra. I don't give you the link of the website because it no longer exists.

Web Development for All!

What makes the Web really useful is its interactivity. By interacting with some remote server, you can find the information you need, do your banking, or buy online. And every time you type something into a web form, a web site "out there" interprets the request generated by your web browser and sends back a response containing a web page with the requested information. But how do you develop such dynamic web pages?

In less than one and a half decades, the Web has become a platform capable of delivering complex and powerful applications. But, at the same time, a bewildering variety of technologies and products has been introduced, all jostling for recognition and market share.

Some (or many!) of you have learnt HTML (Hypertext Markup Language) and written simple pages to present text and images. But the information and the clickable hyperlinks contained in such plain HTML pages are set once and for all at development time. Web sites built exclusively with HTML pages are therefore unable to respond to specific user requests. To tailor page content to the user, you need a means to create HTML pages "on the fly", as they are needed. In other words, you need to develop a web application that analyses the user requests, collects the necessary information, and formulates the appropriate responses.

At the moment, the most widely language used to develop web applications is PHP (Hypertext Preprocessor). When the web server hosting your web site receives a request addressed to your PHP application, it follows the instructions contained in one or more of your PHP modules to put together a web page with the requested information. To be able to do so, PHP usually accesses a MySQL database containing the user profile and part of or all the data requested by the user. More than half of the web servers on line worldwide are Apache HTTP Servers, and the combination Apache + MySQL + PHP is so widely used that the acronym "AMP" has been created to identify it. When the operating system of the web server is Linux, the acronym Becomes "LAMP".

One of the limitations of [L]AMP applications is that PHP is an interpreted language. That is, PHP modules are scripts that the web server needs to interpret every time it processes a new user request. This obviously reduces the number of user requests than can be served at any given time. To avoid such a overhead, the best way is to develop applications in a compiled language. For example, Java.

For this purpose, Sun Microsystems introduced the Java servlet application programming interface in June 1997. The servlet package defines Java classes to represent web requests and responses, and all the processing done on the server to generate each response on the basis of the corresponding request is done in Java.

As the Apache web server cannot directly handle servlets, the Apache Software Foundation developed the Apache Tomcat application server to provide an environment in which Java servlets can execute. And to make the development of servlets easier, Tomcat also supports JavaServer Pages (JSP), which let you work with Java as you would work with a scripting language like PHP.

Later, in early 2004, the development of user interfaces was simplified by the introduction of a software development framework named JavaServer Faces (JSF).

This brings us to the title of the book being presented: "Beginning JSP™, JSF™ and Tomcat™ Web Development: From Novice to Professional". The book tells you what you need to know to develop Java-based web applications with JavaServer Pages, JavaServer Faces, and Tomcat. In practical terms, it describes how you can transform any Windows-based personal computer into a fully fledged application web server, and then write Java applications for it. And all only using software freely downloadable from the Internet.

I decided to write this manual on the basis of two considerations: one technical and one human in nature. The technical consideration was that the alignment of JSP 2.1 and JSF 1.2 achieved with Java Platform, Enterprise Edition 5 (Java EE 5), and the subsequent release of Servlet 2.5 and Tomcat 6, had finally realized full consistency across the whole platform. The human consideration was that, although a lot of information and documentation was available by searching the Web, there was a need for a compendium capable of taking a reader through all the steps necessary to build a Java-based web application.

In my endeavour to cover all the relevant subjects, I included chapters dedicated to HTML, JSP, databases, JSF, Tomcat, and XML, and sections on Java and HTTP. I also touched on Cascading Style Sheets (CSS), JavaScript, Asynchronous JavaScript and XML (Ajax), and Simple Object Access Protocol (SOAP), and provided detailed references for HTML, JSP, JSF, and SQL (Standard Query Language).

This is a practical manual driven by examples rather than by abstract concepts. Nevertheless, I have consistently justified and explained every step taken and every choice made throughout the book. You’ll also discover useful tips and tricks to make your programming life easier. If you keep coming back to this book to look up techniques and to check out options and features, I will have achieved my goal.

Commented Table of Contents

As I already said, "Beginning JSP™, JSF™ and Tomcat™ Web Development: From Novice to Professional" has the ambitious goal of teaching you how to develop dynamic web pages with the first consistent versions of JSP and JSF.

This is easier said than done, because to use JSP and JSF, you need to know at least some Java, HTML, XML, and SQL. Moreover, some knowledge of JavaScript and Cascading Style Sheets (CSS) would also be useful, and you couldn’t fully exploit the power of JSP/JSF without knowing the JSP Expression Language (EL) and the XPath language.

To cover all this ground, I decided to relegate most of the details to appendices and use the main body of the book to teach you key concepts and components with as little clutter as possible.

Chapter 1 introduces you to JSP, describes the general structure of JSP applications, and explains the full code of your first JSP application. At the end of the chapter, I also tell you how to install the application in Tomcat. I knew that you would be eager to see something working, and I didn’t want to make you wait for it!

Chapter 2 is where I cover all aspects and components of JSP. After giving you a brief summary of the Java syntax, I introduce the online bookshop application that I’ll use as an example in several chapters. I then explain how to use JSP variables, directives, and standard actions, how to create your own custom actions, and how to use JSTL and EL. Finally, I briefly describe how to write JSP documents in XML syntax.

Having quenched your thirst for getting into JSP as quickly as possible, I take a step back in Chapter 3 and tell you about HTML. This is important, because HTML is the result of executing JSP pages, and you must be familiar with it. After describing the HTTP request-response mechanism, I explain the HTML components (text, objects, links, tables, and forms), introduce CSS, and give you some examples of JavaScript.

In Chapter 4, I tell you how to access databases from JSP. It would make little sense to talk about dynamic web pages without permanent data storage.

In Chapter 5, I introduce you to JSF and show you how it fits together with JSP.

Chapter 6 is dedicated to XML. After reading this chapter, you’ll understand why developing a web application without XML is unthinkable!

In Chapter 7, I describe Tomcat.

Chapter 8, the last chapter of the book, is dedicated to the online bookshop application. I bring together the pieces I have shown in the preceding chapters and give you the last missing bits.

In Appendix A, I explain how to download and install all the packages you need: Java, JSP, Tomcat, SQL, and so on.

Appendixes B, C, D, and E describe HTML character sets, HTML, JSP, and SQL, respectively. This is where you’ll find the details I left out in the preceding chapters.

Appendix F provides a quick reference to JSF, Appendix G introduces you to the Eclipse integrated development environment (IDE), and Appendix H lists abbreviations and acronyms.

After reading this book, you’ll have acquired a toolbox to develop good-quality web applications. Having the right idea and implementing the next killer application that will make you a million/billionaire is entirely up to you!


  1. Thanks for your insight for the great written piece.
    Loving the info on this site, you have done great job on the posts
    Web Development Company UK

  2. Thanks. It's nice to get recognition!

    Perhaps you could add my blog to the "Blogs I Follow" list in your blogger.com profile? ;-)