JSSP["JavaScript Server Pages"] = keeping.simple.things.simple;

JSSP - JavaScript Server Pages

Home   Downloads   JSSP Docs   JSSQL Docs   Dervish Docs   License   Examples   Feedback

JSSP 0.2beta has been released. Important changes:
- Support for Java 1.4 has been dropped.
- JSSQL functionality is fairly complete. Supports JDBC 3.0 (as of Java version 1.5).
- JSSP now includes Dervish, a technology that allows you to execute code on the server by calling functions in the browser. See here for more information about Dervish.

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.

Table of Contents


What is JSSP?
Hello World in JSSP
Quick start
General advantages of JavaScript
Advantages of JSSP
Embedded SQL example snippet
Limitations
JSSP core components
More information
JSSP Documentation
External documentation
JSSP internals

What is JSSP?

JSSP (JavaScript Server Pages) is a runtime library to generate web pages using JavaScript on a Java web server. It requires a web server that can run Java Servlets (such as Tomcat, JBoss or others).

You don't need to know Java to use JSSP. If you don't have much Java experience, check out the JSSP tutorial which will tell you how to set up and use JSSP.

JSSP is similar to PHP, ASP and JSP. It aims at creating web applications in a simple and efficient way. Its main goal is to reduce the amount of code and the complexity of the code, and it does so by focusing on the essentials: database access and HTML generation.

JSSP is very similar to JSP (Java Server Pages). It uses the same request-response model and even the same objects and methods. You can access Java classes, including your own classes, meaning you can keep existing Java code or add the power of the many available Java libraries to your web application.

JSSP is a little more convenient to program than Java, however. It aims at helping you to concentrate on the "business logic" instead of making you deal with language features you don't even need.

The goal of JSSP is to make simple web development as simple as possible. 

Please note that the JavaScript environment as it is implemented in JSSP is not identical to the JavaScript environment you may know from web browsers. In web browsers you can use objects like window or document to access the browser content. JSSP scripts are not executed in a browser and do not have these objects.

The current version of JSSP is 0.2beta. JSSP comes with an open source license. It is itself based on other open source projects. JSSP can be used for all purposes, including commercial ones, at no charge.

Any comments and bug reports are highly appreciated by leo_meyer@users.sourceforge.net!

Hello World in JSSP

hello.jssp

<html>
<body>
<%
	out.print("Hello JSSP!");
%>
</body>
</html>
hellp.jssp output

Quick start

If you already have a Java web server running you can deploy jssp_example.war from the download section. You can then play around with the example .jssp files to get acquainted with JSSP.

If you don't have much experience with Java or don't have a Java web server, check out the JSSP tutorial which will tell you how to set up and use JSSP.

After setting up JSSP please see the JSSP Description and Reference for further information.

General advantages of JavaScript

Advantages of JSSP

Embedded SQL example snippet

You can embed SQL commands directly in JavaScript code. For this purpose JSSP defines a language extension called JSSQL. More information about JSSQL can be found in the JSSQL description.

<table>
<%
// JSSQL example

// Create a statement for the query.
// Assume that connection has been initialized.
var stmt = connection.SELECT ID, NAME FROM TEST;

// Execute the query.
var rset = stmt.run(); 

// Output a row for each record.
while (rset.next()) {
	// Access columns directly by name without worrying about their type.
%>
	<tr>
		<td>
		<%= rset.ID %>
		</td>
		<td>
		<%= rset.NAME %>
		</td>
	</tr>
}

// Closing the connection automatically closes all associated resources.
connection.close();

%>
</table>

Limitations

JSSP tries to combine the most useful features from JavaScript and Java. It has a simplified programming model while allowing access to a huge code base of robust and proven Java libraries. However, JSSP is not a "framework" in the sense that it supports a certain architecture such as MVC (Model-View-Controller). It mixes HTML layout and code functionality. Thus it may not be suitable for large scale applications where you want to rely on the loose coupling, safety and performance that other environments offer. JSSP can be used as an add-on to those environments, though.

At present, JSSP does not provide special libraries for purposes such as file or network access (though these may come in the future). For these purposes you will have to use Java libraries. Consequently you should be moderately skilled in Java if you need this functionality. For simple web applications (and that's what JSSP is for) this will rarely be necessary, though.

JSSP core components

The JSSP core consists of two separate components, the JSSP web component and the JSSQL component.

The JSSP web component implements the functionality needed to run JavaScript Server Pages on a Java web server. It consists of a servlet (which needs to be activated by configuring the web.xml file) and some support classes in a jar file. The script files that run on the web server get the file extension .jssp.

The JSSP web component also includes the Dervish technology that allows you to call server side code as if it was implemented as a JavaScript function in the browser.

JSSP Description and Reference   Dervish Description and Reference

The JSSQL component implements the embedded SQL support. It consists of a modified Rhino JavaScript parser and runtime engine, the JSqlParser library and a set of support classes that simplify JDBC programming.
JSSQL is not restricted to run on web servers. It is a JavaScript extension that can also be used in standalone scripts (e.g., executed from the command line). Standalone JSSQL scripts get the file extension .jsq.

JSSQL Description and Reference

More information

JSSP Documentation

JSSP Description and Reference

Dervish Description and Reference

JSSQL Description and Reference

JSSP Tutorial

JSSP FAQs

External documentation

Douglas Crockford's JavaScript Pages (highly recommended)

Mozilla developer center: A re-introduction to JavaScript (a good reference)

JavaScript (ECMA-262, ECMAScript) Language Specification (tough stuff!)

Rhino JavaScript Project Home Page (good for Java interoperation issues)

JSqlParser Project Home Page

JSSP internals

JSSP TODO and Feature Wish List

JSSP Release Plan

JSSP Documentation Guidelines


Document version: 0.4, 2008-03-03. Author: Leo Meyer, leo_meyer@users.sourceforge.net

This file is a part of the JSSP project documentation at http://jssp.sourceforge.net.

The JSSP project is hosted by Sourceforge. SourceForge.net Logo