Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

The Example JSP Pages

This chapter illustrates JSP scripting elements using webclient, a version of the hello1 example introduced in Chapter 3 that accesses a Web service. To build, package, deploy, and run the webclient example, follow these steps:

  1. Build and deploy the JAX-RPC Web service MyHelloService described in Creating a Simple Web Service and Client with JAX-RPC.
  2. In a terminal window, go to <INSTALL>/j2eetutorial14/examples/jaxrpc/webclient/.
  3. Run asant build. This target will spawn any necessary compilations and will copy files to the <INSTALL>/j2eetutorial14/examples/jaxrpc/webclient/build/ directory.
  4. Start the Application Server.
  5. Start deploytool.
  6. Create a Web application called webclient by running the New Web Component wizard. Select FileRight ArrowNewRight ArrowWeb Component.
  7. In the New Web Component wizard:
    1. Select the Create New Stand-Alone WAR Module radio button.
    2. Click Browse and in the file chooser, navigate to <INSTALL>/j2eetutorial14/examples/jaxrpc/webclient/.
    3. In the File Name field, enter webclient.
    4. Click Choose Module File.
    5. In the WAR Display Name field, enter webclient.
    6. In the Context Root field, enter /webclient.
    7. Click Edit Contents.
    8. In the Edit Contents dialog box, navigate to <INSTALL>/j2eetutorial14/examples/jaxrpc/webclient/build/. Select duke.waving.gif, greeting.jsp, response.jsp, and the webclient directory, and click Add.
    9. Click OK.
    10. Click Next.
    11. Select the JSP Page radio button.
    12. Click Next.
    13. Select greeting.jsp from the JSP Filename combo box.
    14. Click Finish.
  8. Add an alias to the greeting Web component.
    1. Select the greeting Web component.
    2. Select the Aliases tab.
    3. Click Add to add a new mapping.
    4. Type /greeting in the Aliases list.
  9. Select FileRight ArrowSave.
  10. Deploy the WAR.
  11. Open your browser to http://localhost:8080/webclient/greeting

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 <INSTALL>/j2eetutorial14/examples/jaxrpc/webclient/response.jsp before building and running the examples.


Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.