Creating a Sample Application by Using the Application
Deployment Tool XML

We will now discuss how to develop a sample interest calculator application by using the Application Deployment tool of JWSDP. This will help you understand the procedure for creating an application by using the tool; therefore, it will be useful when you create the actual application for your project.

The interest calculator application calculates the interest payable on a specified amount for a specified period and rate of interest. The application consists of two files as listed:

  • Interest_calc.htm
  • Interest_calc.jsp

Interest_calc.htm File

The Interest_calc.htm file displays a form to the user. In this form, the user enters the following information into the appropriate text boxes:

  • Principal amount
  • Period
  • Rate of interest

When the user submits the form after providing the values, the values are passed to a JSP page, which calculates and displays the result to the user. The code for the Interest_calc.htm is as follows:

Interest_calc.jsp File

The Interest_calc.jsp file accesses the values that the user enters into the HTML page. The JSP page performs calculation on these values and displays the calculated interest to the user.

The code for the Interest_calc.jsp file is as follows:

Deploying the Interest Calculator Application

Now that you have created the files for the Interest Calculator application, you need to deploy the application. You can use the Application Deployment tool of the JWSDP to deploy the application. To deploy the interest calculator application, you need to perform the following steps:

  1. Open the Application Deployment tool by executing the following command at the command prompt:
  2. C:/> deploytool
  3. The Application Deployment tool is displayed in Figure.
  4. The Application Deployment Tool of the JWSDP

    The Application Deployment Tool of the JWSDP

  5. Go to File, New Web Application. The Introduction page of the New Web Application Wizard is displayed.
  6. Click the Next button. The WAR File page of the wizard is displayed, as shown in Figure.
  7. The WAR File Page of the Wizard

    The WAR File Page of the Wizard

  8. On this page, specify the name and location of the WAR file by clicking on the Browse button. The Choose Module File dialog box is displayed.
  9. Select the path and name of the WAR file, as shown in Figure, and then click on the Choose Module File button.
  10. The Dialog Box to Specify the WAR File

    The Dialog Box to Specify the WAR File

  11. The WAR File page of the wizard is displayed again. Specify WAR Display Name as Int_calculator.
  12. To specify the contents of the WAR file, click on the Edit button. The Edit Contents of Int_calculator dialog box is displayed, as shown in Figure.
  13. The Edit Contents of Int_calculator Dialog Box

    The Edit Contents of Int_calculator Dialog Box

  14. Select the Interest_calc.htm and Interest_calc.jsp files and click on the Add button. The files are displayed in the Contents of Int_calculator box, as displayed in Figure
  15. The Dialog Box Used to Specify the Content of the WAR Files

    The Dialog Box Used to Specify the Content of the WAR Files

  16. Click the OK button to close the Edit Contents of Int_calculator dialog box.
  17. The WAR File page of the wizard is displayed again. Notice that the two selected files are displayed in the Contents box, as shown in Figure.
  18. The Contents Box

    The Contents Box

  19. lick on the Next button.
  20. The Choose Component Type page of the New Application Wizard is displayed, as shown in Figure. You need to select the JSP option button and then click the Next button.
  21. The Choose Component Type Page

    The Choose Component Type Page

  22. The Component General Properties page is displayed. Select the Interest_calc.jsp file from the JSP Filename drop-down list, as shown in Figure.
  23. The Component General Properties Page

    The Component General Properties Page

  24. Click the Next button. The Review Settings dialog box displays the deployment descriptor of the WAR file. This dialog box is shown in Figure.
  25. The Review Settings Dialog Box

    The Review Settings Dialog Box

  26. Click on the Finish button. The Application Deployment tool is displayed again. The WAR file that you created is displayed in the left pane, as shown in Figure.
  27. The Application Deployment Tool with the WAR File

    The Application Deployment Tool with the WAR File

  28. You have created the WAR file. To deploy it, go to the Tools menu and select Deploy.
  29. In the Text Input Dialog dialog box, specify the Web context of the WAR file, as shown in Figure.
  30. The Text Input Dialog Dialog Box

    The Text Input Dialog Dialog Box

  31. The Deployment Console dialog box displays the status of the deployment. Click on the Close button when the deployment is complete.

Running the Interest Calculator Application

You have now deployed the interest calculator application. The application is ready to be executed. To run the interest calculator application, type the following command in the address bar of the Web browser:

http://localhost:8080/Int_calculator/Interest_calc.htm

The interest calculator is displayed. You need to enter a principal amount, interest rate, and period values, as displayed in Figure.

The Form for Entering the Values

The Form for Entering the Values

When you click the Submit button, the values are passed to the JSP page, Interest_calc.jsp, which calculates and displays the result, shown in Figure.

The Calculated Interest

The Calculated Interest



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XML Topics