Java: View Technologies and Frameworks
Encyclopedia
Various Java Web application frameworks have appeared in recent years. Some of them are in direct competition
, while others are complementary technologies. It is therefore necessary to understand where exactly each technology/framework fits into the J2EE scheme of things. This page lists the View technologies. These are the frameworks which are used for defining the web pages and the server-side programs which handle the requests (clicks) generated by the web pages.
Competition
Competition is a contest between individuals, groups, animals, etc. for territory, a niche, or a location of resources. It arises whenever two and only two strive for a goal which cannot be shared. Competition occurs naturally between living organisms which co-exist in the same environment. For...
, while others are complementary technologies. It is therefore necessary to understand where exactly each technology/framework fits into the J2EE scheme of things. This page lists the View technologies. These are the frameworks which are used for defining the web pages and the server-side programs which handle the requests (clicks) generated by the web pages.
At a glance
HTTP Paradigm | Component Paradigm | Templating |
---|---|---|
Struts | Wicket | Tiles |
Tapestry | SiteMesh | |
JSF | Facelets | |
Jt Design Patterns | Click |
- Struts is relatively easier to use for beginners because it contains the familiar HTTP paradigm of Request/Response. However, the Component based frameworks are architecturally superior, and usually recommended for creating more complex web applicationWeb applicationA web application is an application that is accessed over a network such as the Internet or an intranet. The term may also mean a computer software application that is coded in a browser-supported language and reliant on a common web browser to render the application executable.Web applications are...
s. - Wicket, Tapestry and JSF are competing technologies.
- Tiles is a templating framework which is designed to work with Struts.
- SiteMesh can be used with any JSP.
- Facelets is a view definition and templating technology designed to work with JSF.
- Jt is a design pattern framework for the rapid implementation of web applications. It features a wizard application for automated generation. It supports JSP, struts and Ajax.
- Wicket, Tapestry and Facelets have their own native templating.
- Click uses HTML based velocity templates and plain old Java objects. JSP is optional.
Servlet API
- This is the foundation of almost all Java View technologies.
- It provides the basic framework for writing Java classes, called 'Servlets' that can respond to HTTP Requests, create Cookies and maintain Sessions.
JSP
- Built on top of the Servlet API, JSP provides for a HTML centric Server programming modelParallel programming modelA parallel programming model is a concept that enables the expression of parallel programs which can be compiled and executed. The value of a programming model is usually judged on its generality: how well a range of different problems can be expressed and how well they execute on a range of...
. - Java code is embedded in the JSP files and is executed when a request is received.
Struts
- Built on top of the Servlet API, Struts provides for decoupling between the Controller and the View.
- Requests are received by a Java Class (Controller) which can decide which View to display.
- The actual View is written as a JSP page.
- An XML configuration fileConfiguration fileIn computing, configuration files, or config files configure the initial settings for some computer programs. They are used for user applications, server processes and operating system settings. The files are often written in ASCII and line-oriented, with lines terminated by a newline or carriage...
is used to specify the "Page Navigation", i.e. the flow of the request to the appropriate Controller, and which View to display based on the outcome of the Controller. - Competitor: Though Struts does not have any direct competitor in its league, Component View Technologies (like Wicket, Tapestry, JSF) are generally accepted as superior.
Tiles
- This is a HTML templating framework based on the "Composite" model.
- It allows for the HTML page to be broken up into multiple pagelets, called Templates, Definitions and Composing pages.
- At run timeRun timeRun time, run-time or runtime may refer to:* Run time , the period during which a computer program is executing* Run-time system, software designed to support the execution of computer programs...
the pagelets are stitched together to generate the final HTML. Pages are written in JSP. - Competitor: SiteMesh
SiteMesh
- SiteMeshSiteMeshSiteMesh is a Java web application development framework developed by OpenSymphony.According to OpenSymphony, SiteMesh:* Is a web-page layout and decoration framework and web application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel,...
is a HTML templating framework based on the "Decoration" model. - It allows for the creation of a 'decoration' template which is then applied to any other HTML to generate a new HTML.
- The newly generated HTML contains elements from the original HTML blended into the template.
- This allows for the original HTML to be very simple and devoid of any formatting or layout specification. The template, in turn, is devoid of any actual information.
- Blending the two allows for a consistent look and feelLook and feelIn software design, look and feel is a term used in respect of a graphical user interface and comprises aspects of its design, including elements such as colors, shapes, layout, and typefaces , as well as the behavior of dynamic elements such as buttons, boxes, and menus...
for all web pageWeb pageA web page or webpage is a document or information resource that is suitable for the World Wide Web and can be accessed through a web browser and displayed on a monitor or mobile device. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext...
s. - Competitor: Tiles...
Wicket
- Wicket provides a 'Component' view technology - meaning the Request-Response Stateless paradigm of HTTP is abstracted away to give rise to an Object OrientedObject-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
Stateful paradigm. - Pages now directly interact with Stateful Java Components on the server.
- Components and their State are managed by the Wicket frameworkWicket frameworkApache Wicket, commonly referred to as Wicket, is a lightweight component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Version 1.0 was released in June 2005...
, freeing the application developer from having to use HttpSession directly to manage state themselves. - Further, Wicket provides for a clear separation of HTML markupHTML elementAn HTML element is an individual component of an HTML document. HTML documents are composed of a tree of HTML elements and other nodes, such as text nodes. Each element can have attributes specified. Elements can also have content, including other elements and text. HTML elements represent...
from code, and there are no XML configuration files to manage. - Web page components are 'pushed' into the HTML markup from the code.
- Competitor: Tapestry, JSF
Tapestry
- TapestryTapestry (programming)Apache Tapestry is an open-source component-oriented Java web application framework to implement applications in accordance with the model-view-controller architectural pattern. Tapestry was created by Howard Lewis Ship independently, and was adopted by the Apache Software Foundation as a top-level...
provides a 'Component' view technology. - Classes are written as POJOs and Annotations are used to configure them as Tapestry components.
- HTML components can directly refer to the component methods and attributes.
- Competitor: Wicket, JSF
JSF/Facelets
- Java Server FacesJavaServer FacesJavaServer Faces is a Java-based Web application framework intended to simplify development integration of web-based user interfaces....
provides a 'Component' view technology while FaceletsFaceletsIn computing, Facelets is an open source Web template system under the Apache license and the default view handler technology for JavaServer Faces . The language requires valid input XML documents to work...
(optionally) provides xml/xhtml based view definition and templating. - Classes are written as POJOs and Annotations or configuration files are used to associate them with Faces.
- The Unified Expression LanguageUnified Expression LanguageThe Java Unified Expression Language is a special purpose programming language mostly used in Java web applications for embedding expressions into web pages....
allows binding component fields and events to POJO bean properties and methods. - Conversion and validation constraints can be specified in Facelets and are automatically applied, normally resulting in reposting of the same page with error information in case of failure.
- Navigation can be via configuration file rules or directly specified in the page.
- Can transparently support AjaxAjax- Mythology :* Ajax , son of Telamon, ruler of Salamis and a hero in the Trojan War, also known as "Ajax the Great"* Ajax the Lesser, son of Oileus, ruler of Locris and the leader of the Locrian contingent during the Trojan War.- People :...
. - Competitor: Wicket, Tapestry