Getting Started with Jspx

Starting developing web applications with jspx requires three steps. (Download/Configure/Develop). Check the coming video showing these steps in practical sample project. All demos are available for download in the demos section

Download latest jspx

start with downloading the latest version of jspx. You will need to download the jspx-2.1.jar file. Also you may check other downloads available including demos and sourcecode.

Download »

Configure your web project to use Jspx

Jspx is easily inserted in any java web project without affecting its nature. Just add the jspx latest version jar in the web libraries, then configure the web.xml to route requests to jspx engine. There is no configuration files anywhere.

Configure Jspx into your project »

Develop your web forms (HTML+JAVA)

Only Java POJOs and HTML standard tags are needed to start your web app.

Develop your app »

Configure your app with 0 configurations

Start with downloading the latest version of jspx. You will need to download the jspx-2.1.jar file. Also you may check other downloads available including demos and source code.

Please note that some of Jspx features are using external open source libraries, Please note that the following verison are not mandatory, you may use older versions. these libraries are as following:
  1. poi-3.9-20121203.jar apache poi
  2. commons-fileupload-1.2.1.jar apchi common file upload
  3. commons-jexl-2.1.1.jar apchi common JEXL
  4. commons-io-1.3.2.jar apchi common io
  5. slf4j-api-1.7.2.jar slf4j
  6. optional jcl-over-slf4j-1.7.5.jar slf4j bridge for Commons logging
The next step is to configure your web application to use jspx. In order to do so, Jspx has two servlets that should be registered in web.xml file. The below code snippet shows how to configure these two servlets.


<servlet>
	<display-name>JspxHandler</display-name>
	<servlet-name>JspxHandler</servlet-name>
	<servlet-class>eg.java.net.web.jspx.engine.RequestHandler</servlet-class>
</servlet>
<servlet>
	<display-name>ResourceHandler</display-name>
	<servlet-name>ResourceHandler</servlet-name>
	<servlet-class>eg.java.net.web.jspx.engine.ResourceHandler</servlet-class>
</servlet>
<servlet-mapping>
	<servlet-name>JspxHandler</servlet-name>
	<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
	<servlet-name>ResourceHandler</servlet-name>
	<url-pattern>/jspxEmbededResources/*</url-pattern>
</servlet-mapping>
            

  1. RequestHandler this is the main servlet in jspx that will serve your jspx pages. you may use whatever extension to your web file (i.e. .jspx)
  2. ResourceHandler this is the servelt responsible for serving the embedded resources like (JQuery script, JQuery UI images, ...)
Now your project is ready to use jspx and its cool features.

Develop your web forms

Developing web applications in jspx is based on web forms. business cases are divided into pages that contains an html form or more. The following code snippet is showing a simple Hello Jspx with java controller. This example is coming from jspx live demo


			<page contoller="org.bay.jspx.demo.live.HelloJspxController" >
				<html>
					<body>
						<label id="message"></label>
					</body>
				</html>
			</page>
			

package org.bay.jspx.demo.live;

import eg.java.net.web.jspx.engine.annotation.JspxWebControl;
import eg.java.net.web.jspx.ui.controls.html.elements.Label;
import eg.java.net.web.jspx.ui.pages.Page;

public class HelloJspxController extends Page
{
	@JspxWebControl(name = "message")
	Label msg;

	@Override
	protected void pageLoaded()
	{
		msg.setValue("Hello Jspx from Java controller!");
	}
}
			

This example can be fully tested on Hello Jspx (with Java Controller) on live demo.