O'Reilly Book Excerpts: JavaServer Pages
JavaServer Pages: Generating Dynamic Content
This excerpt is Chapter 5 from Java Server Pages, published in December 2000 by O'Reilly.
JSP is all about generating dynamic content: content that differs based on user input, time of day, the state of an external system, or any other runtime conditions. JSP provides you with lots of tools for generating this content. In this book, you will learn about all of them--standard actions, custom actions, JavaBeans, and scripting elements. Before we do that, however, let's start with a few simple examples to get a feel for how the basic JSP elements work.
In this chapter, we develop a page for displaying the current date and time, and look at the JSP directive element and how to use JavaBeans in a JSP page along the way. Next, we look at how to process user input in your JSP pages and make sure it has the appropriate format. We also look at how you can convert special characters in the output, so they don't confuse the browser.
What Time is It?
Using JSP Directives
Input and Output
Setting JavaBean Properties From User Input
Keep On Doing It 'til You Get It Right
Formatting HTML Output