link to table of contentsgo to previous topicgo to next topiclink to glossaryindex of terms


Creating the Math Project

The AppComposer/examples/Math directory contains the JSP and HTML files that your capsule uses. Open the directory to see the files this project uses.

The file mathmain.html is a static HTML page that contains a form with various fields that a user can fill in. Open it in a browser.

The page offers to perform three different kinds of calculations for a series of numbers that the user specifies. The first calculation finds the numbers' squares. The second calculates their reciprocals (one divided by the number). The third calculation finds the numbers' sines.

Once you decide which calculations you want to perform, you have to designate a series of numbers to use in the calculations. You pick a value to begin the series with, and one to end it. The input fields on the form allow entries of up eight digits, so within that constraint you can enter any number.

If you entered values and submitted the form now, your browser would display an error message, because nothing has been set up yet to process the information from the form and send the results back to the browser. You need to build a servlet for this. It will process the input, check for any errors, and generate a table that displays results for the numbers and calculations that the user chooses.

Working with Files in a Project

The Projects pane is in the upper left corner of your AppComposer window.

If you do not have a project pane open, select Projects from the View menu or click the Project tab on the tool bar. The project editor allows you to track all of the resources for a multi-file project.

Note: AppComposer's project editor governs the file tree, or relative paths between the capsules and resources in your project. Any reference from the capsule to the other files in the project must use the path as the project editor defines it, which may differ from how they are saved on your hard drive.

To add resources to a project:

  1. Open a new project.
    File -> New Project
  2. Name it Math.zap and save it in the AppComposer/docs/manuals/tutorials/ directory..
    File -> Save As... Math.zap
  3. From the Project menu, select Add...
  4. Browse to AppComposer/examples/Math.
  5. Select mathmain.html.
  6. From the Project menu, select Add... again.
  7. Select mathtable.jsp.

To create the MathProcess capsule:

  1. Create a new servlet capsule.
    File -> New Capsule -> Servlet
  2. In the capsule outline pane, rename Capsule to MathProcess.
  3. Select File -> Save As.
  4. In the AppComposer/docs/manuals/tutorials/ directory, save the capsule as MathProcess.zac.

To add MathProcess.zac to the Math project:

  1. From the project menu open the Add... dialog box.
    Project -> Add...
  2. Browse to the AppComposer/docs/manuals/tutorials/ directory.
  3. Select the file MathProcess.zac.
  4. Click Open.
    This adds the MathProcess.zac capsule to the Math project.
  5. Save the Math.zap project.
    File -> Save

Use a text or HTML-source editor to take a look at the JSP and HTML files in the project. You will use these resource files to create a servlet that takes the input from the mathmain.html file and processes it to create results to display in the mathtable.jsp file.

The next section shows you how AppComposer handles communication between servlets and external files and gets you started building the logic for this project.

link to table of contentsgo to previous topicgo to next topiclink to glossaryindex of terms
      © 2003 DigiSlice Corporation