jspx-bay, commonly referred to as jspx, is a free open source pure Java web RAD framework. Jspx should not be confused with other technologies using the same name like Oracle Application Framework and XML JSP. Jspx extends Java EE servlets to provide an Object-oriented programming model for HTML declarative code. Jspx can be compared to JSF as a web framework. There are many other Java Web frameworks like Apache Wicket that implement such ideas.
Jspx development initially started in February 2008 as a trial to provide an easier way to develop rich interactive web applications in Java. In July 2008, jspx was introduced to the Java community through java.net. Initially jspx had very limited features, including support for web form based development only. https://handwiki.org/wiki/index.php?curid=1172275
In December 2008, the project moved to SourceForge,[1] where it has been hosted since.
The name was chosen to indicate the next step of JSP technology, despite the fact that jspx is significantly different from JSP in that it does not directly embed Java code in HTML. The suffix X is analogous to ASP.NET pages, which have the extension aspx. The official jspx framework name on SourceForge is jspx-bay. The suffix bay distinguished the framework from an earlier inactive SourceForge project named jspx.[2]
On 16 November 2009, the jspx project on SourceForge was purged, and it provides the same content as jspx-bay.[3]
Jspx aims at providing easy to use, developer-friendly APIs. Based on the idea that web development is mostly about customizing the HTML that is presented based on user-input, jspx offers an object-oriented view layer interface to HTML. Jspx provides a means of implementing a stateful user interface over a stateless protocol (HTTP). JSF provides similar functionality, but requires that developers learn an entire new set of tags.
Jspx is relatively new, and combines many features and advantages from existing frameworks while eliminating what might be considered disadvantages. Jspx had the following design goals:[4] https://handwiki.org/wiki/index.php?curid=1486565
Jspx has the following similarities with ASP.NET:
Jspx is different from ASP.NET in the following ways:
Jspx is similar to JSF in the following ways:
Jspx differs from JSF in the following ways:
Jspx can be also compared to many other frameworks, such as Apache Wicket, but jspx uses HTML tags and attributes without an additional XML namespace.
As Jspx is a webform-based framework, for each business case there is one development unit. A development unit in a jspx application consists of two parts:[5]
In addition, the web.xml file must direct traffic to jspx main servlet controller (RequestHandler).
A hello world example can be implemented in many different ways. The following example demonstrates one of them.
<?xml version="#0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w#org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_#xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_#xsd" id="WebApp_ID" version="#5"> <display-name>jspx-demo</display-name> <servlet> <servlet-name>JspxHandler</servlet-name> <servlet-class>eg.java.net.web.jspx.engine.RequestHandler</servlet-class> </servlet> <servlet> <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>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ResourceHandler</servlet-name> <url-pattern>/jspxEmbededResources/*</url-pattern> </servlet-mapping> </web-app>
<page controller="HelloWorld"> <html> <body> <label id="message" /> </body> </html> </page>
import eg.java.net.web.jspx.ui.controls.html.elements.Label; public class HelloWorld extends Page { Label message; protected void pageLoaded() { if (!isPostBack) message.setValue("Hello Jspx World"); } public void setMessage(Label message) { this.message = message; } public Label getMessage() { return message; } }
Note the following about the example above:
<page>
, and must be well-formed XHTML.<page>
element.For the note number 6, the framework is considering using of Dependency Injection to eliminate such limitation and any coupling of HTML and java code.
Jspx build 1.0.9 provided new way of linking HTML controls to Java controls in the page controller. The above example showed the need to add getter and setter for each control. This methodology created the following cons:
For all these reasons build 1.0.9 is using Java Annotation to link Java objects to HTML. The following example is an alternative to the above one.
import eg.java.net.web.jspx.ui.controls.html.elements.Label; public class HelloWorld extends Page { @JspxWebControl(name="message") Label msg; protected void pageLoaded() { if (!isPostBack) msg.setValue("Hello Jspx World"); } }
As noted the size of the code is very much reduced. Also it is noted that the annotation @JspxWebControl is using an attribute name which is an optional attribute. The value of this attribute should be the same as the id of the HTML control. This technique removes the coupling between HTML and Java code.[6]
Some consider this new feature an insignificant addition to the framework. They use the JspxBean to link the HTML form to Java Model Object, and do not declare server side controls linked to the HTML controls.
JspxBean in build 1.0.9 also has been improved, there is no need to create getter and setter for every JspxBean. Forgetting to add getter and setter was a very common mistake causing the developer to loose the link with the HTML. Dependency Injection is used to inject the JspxBeans without the need for getters and setters.
Jspx does not allow Java code inside HTML page. However, in order to satisfy the need of injecting data from the controller; Jspx fully supports Expression Language.
Some examples on EL as following:
public String getCustomerName()
Any framework is evaluated according to different criteria aspects, the following which jspx needs more improvements.
Jspx offers some powerful features like:
Jspx tries to minimize external jar dependencies, however there are some essential jars: [12]
Jspx had made its first public appearance at Java Developer Conference 2010 (JDC). Java Developer Conference is the largest Java event in MENA, organized by EGJUG.[13]
Jspx distribution package includes several files beside the binary jar and the source code. Since the first release on SourceForge the distribution included a demo project as a binary war file and a zipped source code. That project was a simple discrete pages showing different features of Jspx. There was no common business module wrapping these pages, beside it had a poor GUI design. Jspx build 1.1.0 add new demo project that facilitates the easy use of jspx to develop common business case of interacting with DB. The demo is using MySQL. Sql script file is separately downloadable. https://handwiki.org/wiki/index.php?curid=1342358
Some of jspx features are used like Master/Content pages, Ajax, DataTable, Validators and web forms.
With Jspx 1.2 there were two new demo projects added. One offline Demo was jspx-demo3, that is demonstrating the use of jspx to create simple asset tracking application. The other demo was an online jspx live demo.
The content is sourced from: https://handwiki.org/wiki/Software:Jspx-bay