Java view technologies and frameworks: Difference between revisions

Content deleted Content added
Rharner (talk | contribs)
Major rewording, minor reorganizing & alphabetic ordering
Line 1:
'''Java view technologies and frameworks''' are web-based software libraries that provide the user interface, or "view-layer", of Java web applications. Such frameworks are used for defining web pages and handling the requests (clicks) generated by those web pages. As a sub-category of [[web application frameworks]], view-layer frameworks often overlap to varying degrees with web frameworks that provide other functionality for Java web applications.
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 [[Java EE|JEE]] scheme of things. This page lists the [[Model–view–controller|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.
 
Java view-layer frameworks often claim to support some or all of the [[Model–view–controller]] design pattern.
 
==At a glance==
{| class="wikitable" border="1"
|-
! Action-based frameworks:
! [[HTTP]] Paradigm
| [[Apache Struts]], [[Spring|StrutsSpring MVC]]
! [[Component-based software engineering|Component Paradigm]]
! [[Web template system|Templating]]
|-
! Component-based frameworks:
| [[Apache Struts|Struts]]
| [[Apache Click]], [[Apache Tapestry]], [[Apache Wicket]], [[JavaServer Faces]]
| [[Apache Tiles|Tiles]]
|-
! [[Web template system|Templating]]systems
|
| [[Apache Tapestry|TapestryTiles]], [[SiteMesh]]
| [[SiteMesh]]
|-
|
| [[JavaServer Faces|JSF]]
| [[Facelets]]
|-
|
| Jt Design Patterns
| [[Apache Click]]
|}
 
* Struts is relatively easier to use for beginners because it contains the familiar HTTP paradigm of [[HTTP request|Request]]/Response. However, the Component based frameworks are architecturally superior, and usually recommended for creating more complex [[web application]]s.
* JavaServer Faces (JSF), Tapestry and Wicket are competing component-based technologies, abstracting the stateless HTTP request-response cycle and the servlet API behind an [[Object-oriented programming|object-oriented]], event-driven component model.
* Wicket, Tapestry and JSF are competing technologies.
* In contrast, Struts and Spring MVC are action-oriented frameworks that provide a thinner abstraction layer over the servlet API.
* Apache Tiles is a templating framework which is designed to work with Struts.
* SiteMesh can be used with any [[JavaServer Pages|JSP]].
* Facelets is a view definition and templating technology designed to work with JSF.
* SiteMesh can be used with any [[JavaServer Pages|JSP]].
* 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.
* WicketFacelets, Tapestry and FaceletsWicket have their own native templating approaches based on HTML/XHTML.
* Click uses HTML based velocity templates and plain old Java objects., JSPwith isJSP optional.
 
==Servlet API==
* This is the foundation of almost all Java View technologies.
* It provides the basic framework for writing Java classes, called '[[Servlet]]s' that can respond to HTTP requests, create cookies and maintain sessions.
 
*The ItServlet API is the foundation of almost all Java View technologies. Servlets provides the basic frameworkmechanism for writing Java classes, calledfor '[[Servlet]]s'web applications. thatServlets 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 [[Parallel programming model|programming model]].
* Java code is embedded in the JSP files and is executed when a request is received.
 
==JavaServer Pages (JSP) ==
==Struts==
* Built on top of the Servlet API, StrutsJSP provides for [[decoupling]]an betweenHTML-centric theserver Controllerprogramming and the Viewmodel.
* Java code ismay be embedded in the JSP files and is compiled and executed when a request is received.
 
==Apache Struts==
* Struts provides for a [[decoupling]] of 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 file]] 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''': WicketSpring MVC, JSFGrails
* '''Competitor''': Though Struts does not have any direct competitor in its league, Component View Technologies (like Wicket, Tapestry, JSF) are generally accepted as superior.
 
==TilesApache Tapestry==
* A component-based view framework.
* This is a HTML templating framework based on the "Composite" model.
* Classes are written as POJOs and byte-code transformed at run time
* Configured with annotations and naming conventions rather than XML
* Further,Compared Wicketto providesJSPs, forenforces a clear separation of [[HTML element|HTML markup]] from code, and thereJava are no XML configuration files to managecode.
* HTML templates are directly previewable by web designers
* Changed component classes are live-reloaded into running application for faster development.
* Uses the [[Post-Redirect-Get]] navigation pattern for form submission.
* '''Competitor''': Tiles...Wicket, JSF
 
| [[==Apache Tiles|Tiles]]==
* This is aam HTML templating framework based on the "Composite" model.
* It allows for the HTML page to be broken up into multiple [[pagelet]]s, called Templates, Definitions and Composing pages.
* At [[run time (program lifecycle phase)|run time]] the pagelets are stitched together to generate the final HTML. Pages are written in JSP.
* '''Competitor''': SiteMesh
 
==SiteMeshApache Wicket==
* A component-based view framework.
* [[SiteMesh]] is a HTML templating framework based on the "Decoration" model.
* Pages now directly interact with Statefulstateful Java Componentscomponents on the server.
* It allows for the creation of a 'decoration' template which is then applied to any other HTML to generate a new HTML.
* Components and their Statestate are managed by the [[Wicket framework]], freeing the application developer from having to use HttpSession directly to manage state themselves.
* The newly generated HTML contains elements from the original HTML blended into the template.
* Does not require XML for configuration.
* 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.
* Compared to JSPs, enforces a clear separation of [[HTML element|HTML markup]] and Java code.
* Blending the two allows for a consistent [[look and feel]] for all [[web page]]s.
* '''Competitor''': Tiles...
 
==Wicket==
* [[Apache Wicket|Wicket]] provides a 'Component' view technology - meaning the Request-Response Stateless paradigm of HTTP is abstracted away to give rise to an [[Object-oriented programming|Object Oriented]] Stateful paradigm.
* Pages now directly interact with Stateful Java Components on the server.
* Components and their State are managed by the [[Wicket framework]], freeing the application developer from having to use HttpSession directly to manage state themselves.
* Further, Wicket provides for a clear separation of [[HTML element|HTML markup]] 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
 
| [[==JavaServer Faces| (JSF]]) and Facelets==
==Tapestry==
* A specification for component-based view frameworks.
* [[Apache Tapestry|Tapestry]] provides a 'Component' view technology.
* Mojarra and Apache MyFaces implementations are available
* Classes are written as POJOs and byte-code transformed at run time
* Typically uses Facelets for XML/XHTML-based templating.
* Configured with annotations and naming conventions rather than XML
* Classes are written as POJOs, with and Annotations or XML configuration files are used to associate them with Facespage and component templates.
* HTML templates are directly previewable by web designers
* Changed component classes are live-reloaded into running application for faster development.
* '''Competitor''': Wicket, JSF
 
==JSF/Facelets==
* [[JavaServer Faces|Java Server Faces]] provides a 'Component' view technology while [[Facelets]] (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 Language]] 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.
Line 86 ⟶ 75:
* Can transparently support [[Ajax (programming)|Ajax]].
* '''Competitor''': Wicket, Tapestry
 
| [[==SiteMesh]]==
* [[SiteMesh]] is aan 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 feel]] for all [[web page]]s.
* '''Competitor''': Tiles
 
{{Portal|Java}}