Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Part II The Web Tier

3.  Getting Started with Web Applications

4.  Java Servlet Technology

5.  JavaServer Pages Technology

6.  JavaServer Pages Documents

7.  JavaServer Pages Standard Tag Library

8.  Custom Tags in JSP Pages

9.  Scripting in JSP Pages

Using Scripting

Disabling Scripting

JSP Declarations

Initializing and Finalizing a JSP Page

JSP Scriptlets

JSP Expressions

Programming Tags That Accept Scripting Elements

TLD Elements

Tag Handlers

How Is a Classic Tag Handler Invoked?

Tags with Bodies

Tag Handler Does Not Manipulate the Body

Tag Handler Manipulates the Body

Cooperating Tags

Tags That Define Variables

10.  JavaServer Faces Technology

11.  Using JavaServer Faces Technology in JSP Pages

12.  Developing with JavaServer Faces Technology

13.  Creating Custom UI Components

14.  Configuring JavaServer Faces Applications

15.  Internationalizing and Localizing Web Applications

Part III Web Services

16.  Building Web Services with JAX-WS

17.  Binding between XML Schema and Java Classes

18.  Streaming API for XML

19.  SOAP with Attachments API for Java

Part IV Enterprise Beans

20.  Enterprise Beans

21.  Getting Started with Enterprise Beans

22.  Session Bean Examples

23.  A Message-Driven Bean Example

Part V Persistence

24.  Introduction to the Java Persistence API

25.  Persistence in the Web Tier

26.  Persistence in the EJB Tier

27.  The Java Persistence Query Language

Part VI Services

28.  Introduction to Security in the Java EE Platform

29.  Securing Java EE Applications

30.  Securing Web Applications

31.  The Java Message Service API

32.  Java EE Examples Using the JMS API

33.  Transactions

34.  Resource Connections

35.  Connector Architecture

Part VII Case Studies

36.  The Coffee Break Application

37.  The Duke's Bank Application

Part VIII Appendixes

A.  Java Encoding Schemes

B.  About the Authors

Index

 

The Example JSP Pages

This chapter illustrates JSP scripting elements using webclient, a version of the hello1 example introduced in Chapter 3, Getting Started with Web Applications that accesses a web service.

To deploy and run the webclient example using NetBeans IDE, follow these steps:

  1. Build and deploy the JAX-WS web service MyHelloService described in Building, Packaging, and Deploying the Service.

  2. In NetBeans IDE, select File→Open Project.

  3. In the Open Project dialog, navigate to:

    tut-install/javaeetutorial5/examples/jaxws/
  4. Select the webclient folder.

  5. Select the Open as Main Project check box and the Open Required Projects check box.

  6. Click Open Project.

  7. In the Projects tab, right-click the webclient project, and select Undeploy and Deploy.

  8. To run the application, open the bookstore URL http://localhost:8080/webclient/greeting.

To deploy and run the webclient example using ant, follow these steps:

  1. Build and deploy the JAX-WS web service MyHelloService described in Building, Packaging, and Deploying the Service.

  2. In a terminal window, go to tut-install/javaeetutorial5/examples/jaxws/webclient/.

  3. Run ant. This target will spawn any necessary compilations, will copy files to the tut-install/javaeetutorial5/examples/jaxws/webclient/build/ directory, will create a WAR file, and will copy it to the tut-install/javaeetutorial5/examples/jaxws/webclient/dist directory.

  4. Start the Application Server.

  5. To deploy the example using ant, run the following command:

    ant deploy

  6. To run the example, open your browser to http://localhost:8080/webclient/greeting.

To learn how to configure the example, refer to the deployment descriptor (the web.xml file), which includes the following configurations:

  • A display-name element that specifies the name that tools use to identify the application.

  • A set of servlet elements that identify the application’s JSP file.

  • A servlet-mapping element that defines the alias to the JSP file.


    Note - The example assumes that the Application Server runs on the default port, 8080. If you have changed the port, you must update the port number in the file tut-install/javaeetutorial5/examples/jaxws/webclient/response.jsp before building and running the example.