Home / Support / Swiff Chart Generator / Swiff Chart Generator Servlet Samples for IBM WebSphere Application Server 4.0
Knowledge Base

SAMPLE: Swiff Chart Generator Servlet Samples for IBM WebSphere Application Server 4.0

The information in this article applies to:

  • Swiff Chart Generator 2

Warning: The Swiff Chart Generator Servlets are exclusively running on Unix Systems


  Download Sources (Java code and HTML pages) 

  Download IBM WebSphere Archives (EAR and WAR files) 

 

Overview

In this article we walk you through all the steps you must take to run the Swiff Chart Generator Java Servlets samples for IBM WebSphere Application Server V4.0 AES.

Installing and Running the samples from the IBM WebSphere Archives (For Beginners)

Packing, Installing and Running the samples from the Java sources (For Advanced Users)

Uninstalling the samples

How to run Application Assembly Tool (AAT).

 

Installing and Running the samples from the IBM WebSphere Archives (For Beginners).

  1. Download and unzip the IBM WebSphere Application archives (Download here). This archive contains the following ready-made archives:

    • Samples.war the Web Module containing the Servlets.
    • SwiffChartServletSamples.ear the Web Application including the Samples.war Web Module.

  2. Stop WebSphere. To stop WebSphere, execute the stopserver script located in <WebSphere installation directory>/AppServer/bin.
  3. Install SwiffChartServletSamples.ear on WebSphere Application Server. Use the application installer tool to install the previously created EAR file. The application installer tool is located in the installation directory of WebSphere Application Server.
    1. cd <WebSphere installation directory>/AppServer/bin
    2. SEAppInstall.sh -install <path>/SwiffChartServletSamples.ear -interactive false
    Note: In either case, path is the full pathname of the SwiffChartServletSamples.ear file. Once the EAR archive is installed on WebSphere Application Server, the Servlet files are located in the following directory:
    <WebSphere installation directory>/AppServer/installedApps/SwiffChartServletSamples.ear/Samples.war

  4. Run the samples. Now that the Servlets are correctly installed on IBM WebSphere Application Server, follow the steps below to run the samples:
    1. Restart WebSphere Application Server. To start and stop WebSphere, execute the startserver and stopserver scripts located in <WebSphere installation directory>/AppServer/bin.
    2. Launch your Web Browser and type the following URL:
      http://<hostname>/swfchart_servlet_samples/index.jsp

 

Packing, Installing and Running the samples from the Java sources (For Advanced Users).

  1. Download and unzip the Servlets sources (Download here). This archive contains the following directories:

    • src/ contains the Servlets java source code.
    • html/ contains HTML pages pointing to the Servlets.

  2. Compile the Java Servlets located in the src/ directory.
    javac -classpath <J2EE Servlet Package>:SwiffChart.jar <java_file>.java

  3. Package the HTML/JSP pages and class files into a WAR file.
    1. Start the Application Assembly Tool (AAT). See How to run Application Assembly Tool.
    2. Press Cancel at the Welcome to Application Assembly Tool dialog box.
    3. From the File menu, select New > Web Module.
    4. From the left pane, select the .war file located on top of the tree and press the right button of the mouse to display the contextual menu.
    5. From the contextual menu, select Properties.
    6. From the General tab in the Properties dialog box, type SamplesWar in the Display Name edit box and press OK.
    7. From the left pane, expand the Files folder.
    8. From the right pane, select the Resource Files folder and press the right button of the mouse.
    9. From the contextual menu, select Add Files.
    10. Press Browse..., navigate the disk and select the html/ directory of previously the downloaded achive. Press Select.
    11. Select all the HTML pages as well as the JSP file index.jsp. Press Add. Press OK. Now the HTML/JSP pages are included in the WAR archive.
    12. From the right pane, select the JAR Files folder and press the right button of the mouse.
    13. Press Browse..., navigate the disk and select the src/ directory of previously the downloaded achive. Press Select.
    14. Select SwiffChart.jar. Press Add. Press OK. Now the SwiffChart.jar file is included in the WAR archive.
    15. From the right pane, select the Class Files folder and press the right button of the mouse.
    16. Press Browse..., navigate the disk and select the src/ directory of previously the downloaded achive. Press Select.
    17. Select all the class files. Press Add. Press OK. Now the Servlets class files are included in the WAR archive.
    18. From the left pane, select the Web Component folder and press the right button of the mouse.
    19. From the contextual menu, select New.
    20. Set Component Type to Servlet and click Browse next to the Class Name field.
    21. Expand the WEB-INF tree as far as it goes and classes.
    22. From the right hand pane, select SampleBarJPG.class. Press OK.
    23. Type SampleBarJPG in the Component name edit box. Press Apply.
    24. Now the servlet SampleBarJPG corresponding to the Java class SampleBarJPG.class as been defined.
      Repeat the same operation from step 20 for all the other classes. Press OK when all Servlets have been defined.
    25. From the left pane, select the Servlet Mapping item and press the right button of the mouse.
    26. From the contextual menu, select New.
    27. Form the Servlet drop-down list, select SampleBarJPG and type SampleBarJPG in the URL pattern edit box. Press Apply.
    28. Repeat step 27 for all the other servlets. Press OK when all URL patterns have been defined.
    29. From the left pane, select the Context Parameters folder and press the right button of the mouse to display the contextual menu.
    30. From the contextual menu, select New.
    31. In the Parameter name edit box, type SwiffChartInstallDir.
    32. In the Parameter value edit box, type the absolute path of SwiffChart Generator installation directory. Press OK.
    33. Save the .war file. From the File menu, select Save As and enter Samples.war as the file name.

  4. Construct an EAR file containing the WAR file.
    1. Start the Application Assembly Tool (AAT). See How to run Application Assembly Tool.
    2. Press Cancel at the Welcome to Application Assembly Tool dialog box.
    3. From the File menu, select New > Application.
    4. From the left pane, select the .ear file located on top of the tree and press the right button of the mouse to display the contextual menu.
    5. From the contextual menu, select Properties.
    6. From the General tab in the Properties dialog box, type SwiffChartServletSamples in the Display Name edit box. Press OK.
    7. From the left pane, select the Web Modules folder and press the right button of the mouse to display the contextual menu.
    8. From the contextual menu, select Import to navigate to the Samples.war file previously created. Press Open.
    9. From the resulting dialog box, enter /swfchart_servlet_samples in the Context root edit box.

      Note: The Context root, when combined with the Servlet Mapping defined in the .war file, specifies the URL that users should type in order to access the application. In this case, if accessing the SampleBarSWF servlet directly, the URL is:

      http://<hostname>/swfchart_servlet_samples/SampleBarSWF
    10. Press OK.
    11. Save the .ear file. From the File menu, select Save As and enter SwiffChartServletSamples.ear as the file name.
    12. Close the Application Assembly Tool (AAT) by selecting File > Exit.

  5. Stop WebSphere. To stop WebSphere, execute the stopserver script located in <WebSphere installation directory>/AppServer/bin.
  6. Install the EAR file on WebSphere Application Server SwiffChartServletSamples.ear. Use the application installer tool to install the previously created EAR file. The application installer tool is located in the installation directory of WebSphere Application Server.
    1. cd <WebSphere installation directory>/AppServer/bin
    2. SEAppInstall.sh -install <path>/SwiffChartServletSamples.ear -interactive false
    Note: In either case, path is the full pathname of the .ear file. Once the EAR archive is installed on WebSphere Application Server, the Servlet files are located in the following directory:
    <WebSphere installation directory>/AppServer/installedApps/SwiffChartServletSamples.ear/Samples.war

  7. Run the samples. Now that the Servlets are correctly installed on IBM WebSphere Application Server, follow the steps below to run the samples:
    1. Restart WebSphere Application Server. To start and stop WebSphere, execute the startserver and stopserver scripts located in <WebSphere installation directory>/AppServer/bin.
    2. Launch your Web Browser and type the following URL:
      http://<hostname>/swfchart_servlet_samples/index.jsp

 

Uninstalling the samples

Use the application installer tool to uninstall Web Applications. The application installer tool is located in the installation directory of WebSphere Application Server.

  1. cd <WebSphere installation root>/AppServer/bin
  2. SEAppInstall.sh -uninstall SwiffChartServletSamples

Note: SwiffChartServletSamples is the application name entered in the Display name text field of the Properties Dialog Box for the SwiffChartServletSamples.ear file.

 

How to run Application Assembly Tool (AAT)

To run the Application Assembly Tool (AAT) follow the steps below:

  1. cd <WebSphere installation directory>/AppServer/bin
  2. assembly.sh

References:

Keywords:IBM WebSphere Servlet Java Installation

Swiff Chart Generator