Jump to content

Java view technologies and frameworks

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 49.204.20.31 (talk) at 09:50, 16 April 2014 (Apache Tapestry). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Java view technologies and frameworks are web-based software libraries that provide the user interface, or "view-layer", of Java web applications. Such application frameworks are used for defining web pages and handling the HTTP 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.

Java view-layer frameworks often claim to support some or all of the Model–view–controller design pattern.

Servlet API

The Servlet API is the foundation of almost all Java Web View technologies. Servlets provides the basic mechanism for writing Java classes for web applications. Servlets can respond to HTTP requests, create cookies and maintain sessions.

JavaServer Pages (JSP)

  • Built on top of the Servlet API, JSP provides for an HTML-centric server programming model.
  • Java code may be embedded in 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 can be written in different view technologies, like JSP, free marker template, velocity template etc.
  • 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: Spring MVC, Grails

Apache Tapestry

  • A component-based view framework.
  • Classes are written as POJOs and byte-code transformed at run time
  • Configured with annotations and naming conventions rather than XML
  • Compared to JSPs, enforces a clear separation of HTML markup and Java code.
  • 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: Wicket, JSF, HybridJava

In this Java jGrasp Training Course we will see an introduction to this development environment used to write Java programs. We will see over the course classes, how to create them, what they contain, and how to create objects in the main method. We will also discuss constructors, getters and setters, and... kick ravi teja

Apache Wicket

  • A component-based view framework.
  • Pages 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.
  • Does not require XML for configuration.
  • Compared to JSPs, enforces a clear separation of HTML markup and Java code.
  • Web page components are 'pushed' into the HTML markup from the code.
  • Competitor: Tapestry, JSF, HybridJava

SiteMesh

  • SiteMesh is an 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 pages.
  • Competitor: Tiles


See also

References