Java Reference
In-Depth Information
Chapter 9
Java Server Pages
In this chapter, we will make your programming life easier by introducing Java Server Pages (JSPs). In addition
to making it easier to build a GUI interface, JSPs can use JSP tags and Expression Language (EL) instead of Java
statements. JSP tags (and EL) are very useful because their syntax is much simpler than Java statements.
This chapter will also demonstrate how to create and use Java beans. We will then explore the Model-View-Controller
(MVC) architecture and show how JSPs, beans, and servlets fit into the MVC framework. In addition, we will expand
your knowledge of Web page components and introduce several very useful objects and functions that the server
provides to applications.
In this chapter, you will learn about:
JSPs
Scriptlets, Expressions, Declarations, and Directives
JSP tags and Expression Language
Java Beans
Implicit Objects
Drop-down Menus and List Boxes
Redirect and RequestDispatcher
After this chapter, you should be able to:
Create a JSP
Invoke JSPs from servlets
Define and use beans in JSPs and servlets
Use JSP tags and Expression Language
Tutorial: What is a JSP?
JSPs are Web pages that have Java code mixed in with HTML statements that define the page. The advantage of the JSP
is that instead of writing a servlet, that laboriously embeds HTML statements into a response; a programmer can use
a GUI tool to generate the HTML (that defines a Web page) and then enter the much smaller amount of Java code that
performs the desired functions. Of course, an example is worth a thousand words of explanation.
1.
In the Web Perspective, click the TutorialsWeb/WebContent folder to select it.
Click File , New , and then Folder .
2.
 
Search WWH ::




Custom Search