JOT Servlets - Java Servlet Framework : Home Page


Welcome to JOT Servlets

JOT Servlets is a Java Servlets web components framework that cuts through the layers of J2EE complexity.

With JOT Web Components, web designers and Java programmers can use the skills they already have to create dynamic content for web applications (without JSP, JSF or complex XML programming).

The JOT Servlets MVC architecture provides a clean separation between Java object oriented programming with JOT Beans and web page design with JOT Templates. The JOT Web Components framework renders rich content from composite views. Zero configuration deployment means no special XML configuration files are required.

JOT Servlets work with any J2EE application server, including WebSphere, WebLogic, JBoss and Tomcat.

About JOT Servlets

JOT Servlets is a J2EE software development framework for dynamic content web applications. Dynamic web pages include custom content on-the-fly. Familiar examples of dynamic content are ecommerce shopping cart web pages containing up-to-the-minute information on prices and orders.
Java Web Framework
With JOT Servlets web designers and Java programmers use standard techniques to create dynamic content for web applications (without JSP, JSF or XML programming). Jot Servlets use Java objects (Java Beans and POJO's - plain old java objects) to render dynamic content into standard HTML web pages.
• JOT Web Components are dynamic content building blocks for rendering composite views, portals and tiled layouts. Iterator components render tabular output using Java Collections and database queries. JOT Web Components can be combined with unlimited flexibility to any nesting depth.
• JOT Templates are standard web pages (HTML, XHTML, etc.) with dynamic content web components and server-side scripting.
• JOT Tokens use server-side Java objects to render dynamic content. For example, JOT.customer.lastName renders the lastName property of the customer object.
• JOT Views is a dynamic content rendering engine for Java Servlets and JSP. JOT JSP Tags are custom tags for rendering dynamic content web components.

JOT Servlets Benefits

The JOT Servlets Java web components framework reduces J2EE application complexity and boosts productivity for web designers and Java developers. With JOT Servlets, web designers create dynamic content using standard web pages and programmers develop Java Bean web components using established J2EE technologies.
JOT Servlets Benefits
• Reduced J2EE Complexity: The JOT Servlets framework cuts through the layers of J2EE technologies to make n-tier J2EE resources available for dynamic web content without JSP, JSF or complex XML tags.
• Lower Training Costs: With JOT Servlets, web designers and Java programmers can immediately develop dynamic web content using the skills they already have.
• Efficient Content Development: The JOT Servlets rapid application development architecture leverages a Java web components framework based on a clean separation of tasks between Java programming and web page design.
• Easy Web Scripting: JOT Templates control web content without convoluted programming syntax. JOT Templates do not require JSP expression language or complex XML programming.
• Zero Configuration: JOT Servlets are deployed without additional XML configuration files. Initialization parameters are optional with reasonable defaults.
• Standards Compliant: Web designers can develop dynamic content with JOT Templates that are standard web pages (HTML, XHTML, etc.).
• Web Compatible: The JOT Servlets framework is transparently compatible with all leading web design tools, from FrontPage to Flash. JOT Servlets works with any J2EE application server, including WebSphere, WebLogic, JBoss and Tomcat.

JOT Servlets System Architecture

JOT Servlets produce dynamic web pages in response to HTTP requests sent to a web server. A JOT Servlet renders dynamic content with a JOT Template web page. With JOT Views, any Java Servlet or JSP page can use this architecture to render JOT Web Components.

JOT Template tokens render dynamic content with the properties of server-side Java objects (JOT Beans, J2EE objects, and POJO's - plain old java objects). JOT Web Components render dynamic composite views, including tiled layouts, with nested JOT Templates. JOT Iterators render dynamic tables and lists using Java Collections, JDBC database ResultSets, and other sets of objects.

In this architecture, JOT Beans mediate between the request/response domain of the Internet and the back-end domain of enterprise systems. JOT Beans interface with view-independent business objects that define a clean separation between the web application layer and the enterprise infrastructure layer.

See the Sun system architecture blueprints to learn more about web architecture principles.

JOT Servlets Framework Design Goals

The JOT Servlets Java web components framework presents a simple and powerful paradigm connecting the disparate presentation media of web page designers to the software engineering domain of Java programmers. Designers working with web page tools are concerned with content and human interface issues. Java programmers are concerned with software objects, databases, and enterprise systems.
Design Goals of JOT Servlets Framework
Separate the web page design process from the web tier programming process, allowing each activity to proceed independently.
Maintain 100% compatibility with web page editors and web design tools without requiring that designers learn programming logic or non-standard tags.
Leverage standard Java constructs such as Java Servlets and Java Beans without imposing a steep learning curve for yet another specialized programming paradigm.
Provide a flexible and minimalist servlet API that does not restrict software architecture options.

Tiled Layouts

Tiled Page Layouts:

A tiled design has a master template that arranges the layout of a page in sections called "tiles". One such tiled layout can set the look-and-feel for many pages or an entire site. For instance, the master template can layout a header tile and a menu navigation tile for all pages. The completed pages are rendered with dynamic content in the body tile position. This allows a change in one place to change many pages and reduces copy-and-paste repetition. Tiled layouts are also useful for portal designs where the content of the tiles is composed dynamically.

A JOT Template tiled page layout renders JOT Web Component content into the tile positions. In the following example the MyAppLayout.html master template has header, body, and footer tiles. The JOT.Body token renders dynamic content into the body tile.

<html>
<!-- - - - - - -  MyAppLayout.html  - - - - - - -->
<head>
<title>JOT.Title</title>
</head>
<body bgcolor="#CCCCFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!-- header tile -->
<tr><td>JOT.Content(/webpages/MyAppHeader.html)</td></td>
<!-- body tile -->
<tr><td>JOT.Body</td></td>
<!-- footer tile -->
<tr><td>JOT.Content(/webpages/MyAppFooter.html)</td></td>
</table>
</body>
</html>

The above tiled layout is rendered by the following CustomerPage template. First the title and body properties are assigned. The CustomerInfo component is the content in the body tile rendered with the current customer's information. The JOT.Title token dynamically renders the login name of the current user.

<!-- - - - - - -  CustomerPage.html  - - - - - - -->

<!-- Set properties for the Customer page -->
JOT.Title=(Customer Information for JOT.LoginName)
JOT.Body=(JOT.Views.Component(com.myapp.CustomerInfo,/webpages/CustomerInfo.html))

<!-- Render the tiled layout -->
JOT.Content(/webpages/MyAppLayout.html)

More elaborate tiled designs have tiles arranged in columns and rows. With JOT Web Components, tiles can contain sub-layouts to any nesting depth. The JOT.Repeat token can be used for portal designs that have a variable number of content tiles.

Java Servlets API

Java Servlet technology is a Java standard for developing HTTP web server applications. The Java Servlet API has been called a "better-CGI-than-CGI", because servlets replace server-side programs that in the past would have been CGI scripts written in a language such as Perl. Servlets have a significant performance advantage relative to CGI, because a servlet is created and loaded once by a web server, while CGI scripts are restarted on every web page access.

Java Servlet programmers developing web applications gain the advantages of programming in a feature-rich object oriented language. Servlets naturally leverage other Java technologies such as Java Beans, and interface with middleware protocols, including Enterprise Java Beans (EJB), Java Remote Method Invocation (RMI), Java Database Connectivity (JDBC), and CORBA.

The servlet API is supported across a range of web servers (JBoss, WebLogic, WebSphere, IPlanet, Apache, IIS, and others) and operating systems (Unix, Linux, NT, and others). For more information about servlets, visit the Sun Microsystems Java Servlets web pages.

What About JSP?

JavaServer Pages (JSP) is an extension of Java Servlet technology that provides one approach to dynamic content generation. The JSP acronym suggests it was inspired by Microsoft's ASP (Active Server Pages). Classic JSP employs Java as the server-side web page scripting language, whereas ASP uses BASIC for scripting.

The Problem with Servlets:

Java Servlets provide an elegant interface for handling the HTTP Internet protocol. But servlets do not provide a reasonable way to generate web pages. A bare bones servlet generates HTML with Java println statements one line at a time. This approach to embedding HTML within Java is a cumbersome way to lay out a web page.

Programming in JSP:

JSP reverses the paradigm by embedding Java within HTML. Java scriptlets are embedded in JSP pages with non-standard tags (neither HTML or XML). But experience has shown that mixing Java and HTML in this way results in web pages that are difficult to design and maintain.

A newer JSP approach is to use tag libraries that hide Java code behind XML tags. JSP Standard Tag Library (JSTL), Expression Language (EL), and Java Server Faces (JSF) have transformed JSP into a feature-rich XML programming language reminiscent of Awk or Perl.

Effective use of these JSP programming features requires training and experience with object-oriented software concepts. This evolution of JSP is similar to past attempts at 4GL (fourth generation) languages for non-programmers. Instead, as happened with 4GL's, a new language has emerged that requires a new type of specialized JSP programmer.

Problems with JSP:

There are many server-side approaches for generating dynamic content (see comparisons). JSP's evolving architecture has created layers of technology for programmers to grapple with (Java, and scriptlets, and tag libraries, and expression language, and Struts, and now Java Server Faces). A central concern is the failure of JSP to separate page layout (presentation) from programming logic. JSP has replaced Java scriptlets with an equally complex expression language and XML programming tags. Java Server Faces (JSF) continues this trend of moving programming syntax into the web page, intermixing programming constructs with the presentation view. Problems with JSP have been discussed elsewhere (see Hunter).

JOT and JSP Examples

There are many server-side programming approaches to generating dynamic web content. This example shows four ways to use Java Servlets to create a list of names on a web page. For more information see About JSP.

Which approach adds the least programming code to the web page?

 1. Java Servlet (println statements) :

public void listNames(
    HttpServletRequest req,
    HttpServletResponse rsp) throws IOException
{
    PrintWriter out = rsp.getWriter();
    out.println("<b>List of Names</b><p>");
    List namesList =
        (List)req.getAttribute("NamesList");
    Iterator iter = namesList.iterator();
    while(iter.hasNext()){
        Person p = (Person)iter.next();
        out.println(p.getName()+"<br>");
    }
}
HTML embedded in Java: The servlet writes the response with HTML hardcoded in println statements.
 2. JSP Scriptlet (Java) :

<b>List of Names</b><p>
<%
List namesList =
    (List)request.getAttribute("NamesList");
Iterator iter = namesList.iterator();
while(iter.hasNext()){
    Person p = (Person)iter.next();
    out.println(p.getName()+"<br>");
}
%>
Java embedded in HTML: The scriptlet is pure Java code inside a web page between <% and %> tags. The server transforms the JSP page into a Java Servlet.
 3. JSP JSTL (Standard Template Library) :

<b>List of Names</b><p>
<c:forEach items="${NamesList}" var="person">
    <c:out value="${person.name}"/><br>
</c:forEach>
JSP Programming: The JSTL version uses EL (expression language) with an XML programming syntax that includes scoped variables, operators, and object references.
 4. JOT Template :

<b>List of Names</b><p>
JOT.Repeat(JOT.Persons.Next)
    JOT.Persons.name<br>
JOT.End
JOT Tokens in HTML: The JOT version is plain HTML with JOT Tokens, requiring no knowledge of JSP, XML, JSTL, or EL.