Developing applications with Apache Derby, Apache Myfaces and Facelets

Source: Internet
Author: User

What are JSF, Facelets, and Apache Derby?

The three technologies demonstrated in this article for WEB applications are JSF, Facelets, and java™database connectivity (jdbc™). JDBC is used to access data in the relational database Apache Derby. JSF is a WEB application framework for building the user interface (Interface,ui), Facelets is a presentation technology designed specifically for JSF. Apache Derby is a database that is compatible with pure Java JDBC. The combined use of these three components provides an ideal environment for developing java-based MVC WEB applications.

JSF is introduced first, which solves the need for a clearer separation between the controller and the MVC WEB application view layer. It also has to do with server-side events, rather than relying solely on clients for event-handling JavaScript™. However, the main contribution of JSF is its component-based model, which facilitates reusability and scalability. One disadvantage of using JSF is the technology for rendering layers, which by default is provided by JavaServer pages™ (jsp™). JSP is not a component-based system and therefore cannot take advantage of all the features of the JSF model. The JSP markup in the JSF application renders the view and represents the component, but cannot change the state of the JSF component.

Facelets

This is where the Facelets is used. Facelets is designed specifically to consider JSF's component-based technology, producing the component tree used in the Web application view. The JSP is compiled to create a servlet, and JSP is used to render dynamic content, but this content is not always synchronized with the component tree generated by JSF. Facelets is run in conjunction with the JSF component tree, so there is no need to be surprised at the rendered output-this happens when using JSP for rendering in JSF.

The sample application discussed in this article uses the Facelets Templating feature and demonstrates an example of applying improved error messages that can be captured in Facelets development. There are also a number of Facelets features that you can use that are not discussed in this article.

JSF using the Apache myfaces

The Apache myfaces Project provides the open source implementation of the JSF WEB Application Framework Specification JSR 127. Myfaces provides all the classes required by the specification, as well as other JSF components called Tomahawk. Some of these components provide new functionality, more than those required by the specification, and some components provide enhanced functionality.

You should already be familiar with the background of JSF and want to learn more from this article.

Apache Derby

Apache Derby is used in the Model layer of this example application, which is a virtual flight booking system. Apache Derby is a 0-managed, pure-Java relational database that is perfect for java-based WEB application development due to its embeddable capabilities and compatibility with JDBC standards.

This article focuses on building Web applications using Myfaces, Facelets, and Derby in a comprehensive way, assuming you have a knowledge of web application development, JSF, and the basics of accessing databases through JDBC.

Components of a WEB application

The flight booking application uses the following software components and technologies; The list also includes some of the specific features used in this application.

Apache myfaces JSF Implementation 1.1.4 Core and Tomahawk 1.1.3

validators--includes regular expressions, Equals, and credit card validation.

updateactionlistener--This listener can be associated with a actionsource uicomponent (through a link or a button) to associate a value with a property.

Extended datatable--will use a header to extend the standard JSF DataTable to allow sorting by column.

JavaScript menu--jscookmenu components Create dynamic menus by using CSS and JavaScript to create menu items.

Apache Derby Database Engine 10.1.3.1

Using Derby Embeddeddatasource

To start and stop Derby via Servletcontextlistener

JDBC callable Statement The process of executing a store, writing SQL statements to a message log file in Derby

JDBC Prepared Statements is used to insert or delete Derby records.

FACELETS--JSF View Definition Framework 1.1.11

Templating-the ability to create templates for page code reuse and substitution.

Improved error messages-easier to debug.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.