Neatware  Header

Why Snaml

Java platform

Java 2 Enterprise Edition (J2EE) is a platform for enterprise business solutions on server-side. It consists of core technologies such as Servlets, JSP, EJB, JDBC, JNDI, RMI, and JMS for the development of Web applications. Its n-tier application framework are divided into presentation, business logic, and data access tiers. Servlets and Java Server Page (JSP) are suggested solution for presentation tier. Enterprise Java Bean (EJB) works for business tier. And Java database connection (JDBC) links database and Java applications.

Java 2 Standard Edition (J2SE)is a platform for Java application development. It works for desktop and laptop computers. Its runtime environment is Java Virtual Machine (JVM).

Java 2 Mobile Edition (J2ME) is a Java platform for mobile applications. J2ME is "a highly optimized Java run-time environment targeting a wide range of consumer products, including pagers, cellular phones, screen-phones, digital set-top boxes and car navigation systems." J2ME uses configurations and profiles to customize the Java Runtime Environment (JRE). The J2ME's Virtual Machines KVM and CVM are subsets of Java Virtual Machine (JVM).

JSP and its drawbacks

Java Server Page (JSP) is the normal solution for presentation of Web applications. JSP defines special HTML tags, a scripting language, and mechanism to call external beans. It separates HTML presentation from the content generation to allow the use of author tools for Web design. It tries to provide a framework for web presentation in the way of consistency, modularization, and reuse.

JSP Workflow

When you click the URL of a JSP page, this page is converted to a source code of Java servlet. Then Java Just-In Time (JIT) compiler compiles it into a class file. Finally, the class loader loads the class into Java Virtual Machine (JVM) and executes it in a new thread.

Initially JSP Model 1 was developed as a page-centric approach in which the business logic is embedded in the pages. To make the architecture clean JSP Model 2 was developed to use the Model-View-Controller (MVC) Design Pattern in which the servlets are used as Controller to handle request and JSP pages are used as View to response, and Java Bean are used as Model to handle data access.

JSP is an extension of servlet technology for Web page presentation. There are few arguments about the use of servlets in Java for Web application, however, there are debates to use JSP as a standard Web presentation solution. JSP technology has some drawbacks.

Like Active Server Page (ASP), JSP targets to solve the Web presentation problem by separating the HTML page and control logic, so Web design team and Java programmer team can work simultaneously. However, from the procedure analysis, we know that JSP requires recompile in runtime, which may take longer time to load a page. Thus, it increases the response time and decreases the performance. This is also low efficiency in use of resources. Moreover, the steep learning curve for new scripting language and tag vocabularies reduces the productivity of developers. The JSP's use of include and template to solve the layout and reuse problem in the Web design is also not naturally suitable in the Object-oriented model.

Jason Hunter, the author of the book "Java Servlet Programming", published an article The Problems of JSP , described more JSP's difficulties.

There are alternative solutions such as Velocity, XMLC, and XSL. Velocity uses templates to represent views. However, its use of deep Java reflection leads complexity. XMLC is used in the Enhydra's Java application server. It compiles an HTML into a Java class by using the ID, CLASS, and SPAN in HTML. This approach is not efficiency for dynamic content generation. XSL transforms one XML to another language such as HTML. However, developers need to write another transform script.

In summary, JSP and its replacements are limited as a solution for Web applications. Snaml for Java from Neatware, which is based on servlet and XML technologies, provides a better solution for Web and mobile applications.

Servlets

Servlet is the foundation of Java's server technologies. In the Servlet 2.2 Specifications, a Web application is defined as "a collection of servlets, HTML pages, classes, and other resources that can be bundled and run on multiple containers from multiple vendors."

Servlets are a vast improvement on heavyweight CGI scripts by lightweight Java threads. The none-GUI runtime and native thread support make servlets to be very high-performance for server application. Servlets can also handle and synchronize multiple requests to support collaboration. Finally, another great advantage of servlets is its scalability from single processor to grid of processors.

Snaml for Java

Hypertext Markup Language (HTML) is a description language for web document. The new Extensible Markup Language (XML) of W3 standard extended HTML to allow authors define new tags and attributes. XHTML 1.0 is an XML application for HTML 4.0. XHTML is designed to be the presentation standard for both web and mobile document. As description languages, XHTML and XML are very suitable to represent embedded documents. However, since these languages are lack of variables, it is difficult to use them as programming languages.

XHTML is the refine and modularization of HTML based on XML. Since new generation of web browsers provide full support of Cascading Style Sheets (CSS), the new web pages are separated by their content and presentation. Although Snaml for Java/XHTML supports the full HTML via XHTML, we encourage developers to use the new CSS control to generate clean web content.

Wireless Markup Language (WML) is an XML language for WAP applications on mobile phone and PDA. cHTML is a subset of HTML for i-mode of DoCoMo. It will be finally replaced by a standard subset of XHTML.

Snaml refers to Snaky Markup Language. (It represents an ancient snake. When Snaml's head is attacked, its tail will come to help; when its tail is attacked, its head will be back to help; when its body is attacked, both head and tail will come to defense.)

Snaml for Java is a servlet package for XML processing. It can work with any J2EE platforms and development environments such as NetBean, Eclipse, WebSphere, WebLogic. and SunONE Snaml XHTML is a class extension from HTTP Servlet for web development. In addition, Snaml WML is a servlet extension for Mobile (WAP) applications.

Developers can use the Snaml package to generate XHTML/WML pages dynamically. They can build a website in higher level consistency by using the Snaml for layout. In addition, Snaml for Java is much easier to connect to a database and complete session management. Since Snaml for Java is implemented as servlets it was fast, maintainable, and reusable.

Snaml benefits

Scalability
Snaml for Java is scalable for multiple processor without code modification and support servers from grid computing to mobile applications.

Manageability
Program of Snaml for Java can integrate with EJB and JDBC components in J2EE/J2ME platform.

Reusability
Snaml for Java is a package of servlet components. Developers can embedded the package into any Java development environments such as NetBean and Eclipse.

Performance
Because of the native multiple thread support of servlets, Snaml for Java can immediately benefit from the multiple processors and new chip technology such as HyperTherading in Intel's Xeon .

Standard support
The support of XML and J2EE standards allows Snaml for Java widely used for more applications.

In summary, Snaml for Java is a good alternative to replace JSP for presentation in Web applications. By using the Snaml for Java, you can create a Web application in high consistence, high performance, and highly reusable.