JSP Demo

The JSP Demo demonstrates how to use the HTTP JSP Bundle to register JSP resources in the HttpService. It registers two JSP pages with an alias jspdemo.

Contents:


Demo Components

The bundle of the JSP Demo is jspdemo.jar, located in the demo/bundles folder. The other demo components are in the folder demo/framework/jsp. It contains a script for installing the demo through the Kit Manager Bundle - install.txt, and for translation, compilation and bundling the demo files - mk. The readme.txt file gives a short description of the demo. There are two JSP source files - device.jsp and error.jsp. The first one represents the actual demo and the second is an error page, that shows in case of deficiencies during the demo operation. There also is a DeviceBean.java file, which holds a java bean, used by the servlets. The mk file first calls the JSP Tool, which translates the JSP pages into Servlets and then compiles them. It passes several parameters to the tool, among which is the requirement to generate automatically a Bundle Activator and to place the generated sources into a demo.jsp package. There are two image files placed in the demo/framework/jsp/demo/jsp folder. The output Java and CLASS files are issued into the demo/framework/jsp folder and the built JAR file - correspondingly in the demo/bundles folder.

Starting the Demo

To start the demo you must first install the demo bundle and the bundles it depends on - the JSP API Bundle and the HTTP JSP Bundle. It is recommended, but not compulsory, to uninstall the HTTP Bundle, which is installed by default. You may use command line like the following:

>$fw.i -s ../../../demo/bundles/jspdemo.jar

You may also use the install.txt file through the Kit Manager Bundle for automatic installation. First you have to go to the kitman pluggable commands group and then invoke the suitable command. You may also invoke the kitman install command from another command group. Here is an example of such a command:

>kitman.i 23

Inside the Demo

The JSP Demo Bundle is represented by two JSP pages and one Java class.

Using the Demo

The JSP Demo bundle registers two JSP pages, the second of which - error.jsp (available under the http://<mBServer_host>/jspdemo/Error URL), shows automatically if any problems occur during the demo runtime. To access the main page type http://<mBServer_host>/jspdemo/Device in the location bar of your browser. For example, if the server is running on the local machine, you may type http://localhost/jspdemo/Device. The page that shows up is generated by the demo.jsp.Device class.


Figure 1: The Device JSP Page


Framework Demos