Home Downloads JSSP Docs JSSQL Docs Dervish Docs License Examples Feedback
This tutorial helps you to get started with JSSP.
Any comments and bug reports are highly appreciated by firstname.lastname@example.org!
Bug reports, feature requests and forum posts can be submitted on the JSSP Project Page.
Note: This document uses Google's code prettifier. In Internet Explorer you may get warning messages about active content. You can safely allow active content or simply ignore these messages.
This tutorial walks you through the steps necessary to deploy and modify the jssp-example application and tells you how to setup and connect a MySQL database to JSSP.
Download a recent Java Development Kit (JDK) from
On Linux you can also use sudo apt-get install gij or use the setup tool of your choice.
It is recommended that you use the most recent Java version available.
Install Java using the default settings. Set the environment variable JAVA_HOME to the root folder of your JDK installation (not the JRE folder that may also have been installed).
Download a recent Tomcat version from http://tomcat.apache.org. Instructions for installation are provided on the same web site.
In the conf folder of your Tomcat installation there's a tomcat-users.xml file. Open the file in a text editor and add the following lines to the <tomcat-users> section:
<user username="admin" password="mypassword" roles="admin,manager"/>
This defines a user "admin" that has access to the administration application.
Start Tomcat (startup scripts reside in the bin folder) and point your browser to http://localhost:8080/manager/html. Login with user "admin" and password "mypassword". You should see the list of currently installed applications.
Note that for Linux installations the HTML administrator sometimes comes in a separate package, so be sure to install that as well.
An example web application (jssp-example.war) is available for download at the download section. Save it to a folder of your choice.
Deploy the local jssp-example.war file to your Tomcat (bottom section of the web application page). This installs the JSSP example application:
Click on the link /jssp-example in the list. You should see the JSSP welcome screen.
The jssp-example application contains a number of scripts that demonstrate some features of JSSP. The database examples use the in-memory database HSQLDB, so there's no need to install an external database. However, when you stop the application, the data is lost. The section below explains how to connect an external database to JSSP.
Tomcat automatically unpacks the .war file on deployment. The jssp files extracted from the .war file are located in the webapps/jssp-example folder below your Tomcat installation. Have a look at the source; you can also examine the generated jsspi files that contain the intermediate code. Modified jssp files will be executed when you reload the page; thus you can experiment with the source code to get a feeling for JSSP. There are also some example libraries under WEB-INF/jssp that might be interesting to play with.
Note that when you re-deploy the .war file any changes to the already deployed files are overwritten.
Download a recent MySQL installation from http://www.mysql.org and install it. Connect to the database with the administration tool of your choice (for example, MySQL Administrator).
Create a MySQL database catalog named "jssp". Create a user "mysql" with password "mysql" and give this user full permissions on the jssp catalog.
The example download already contains the necessary driver to connect Java to MySQL. All you need to do is activate the MySQL data source in the configuration file jssp.xml and modify the files dbtest.jssp and dbmeta.jssp to use a different data source.
First, edit the file WEB-INF/jssp.xml. Uncomment the following lines:
<datasource> <name>mysqldb</name> <class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</class> <param name="url" value="jdbc:mysql://localhost/jssp?user=mysql&password=mysql"/> </datasource>
In the dbtest.jssp and dbmeta.jssp files change the assignment of the data source:
// var datasource = pooledHsqldb; var datasource = mysqldb;
In the dbtest.jssp file modify the table creation script for MySQL (around line 40; comment the line for HSQLDB and uncomment the line for MySQL with "--"):
-- the ID column must be defined differently for different database types
-- ID INT NOT NULL IDENTITY PRIMARY KEY, -- HSQLDB
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -- MySQL
-- ID INT IDENTITY (1, 1) NOT NULL PRIMARY KEY, -- MS SQL Server
Save and reload the page in your browser to test the database connection.
Note: If you re-deploy the jssp-example application the changed files will be overwritten.
You have successfully installed and run your first JSSP application. Now it's time to move on and write your own!
The next section provides you with links to more information. Have fun!
JSSP Description and Reference
JSSQL Description and Reference
JSqlParser Project Home Page
Document version: 0.2, 2007-05-24. Author: Leo Meyer, email@example.com
This file is a part of the JSSP project documentation at http://jssp.sourceforge.net.
The JSSP project is hosted by Sourceforge.