JSF and the perfect combination of the web highly enhance development efficiency

Source: Internet
Author: User
Tags config html form html page implement interface client java web visual studio
Js|web

Compared with the support of visual tools developed by Microsoft Visual Studio.NET program, people still need to write a large number of labels while developing the java-based Web user interface, and also consider the preservation of the page state information, the client event processing and so on, the development is more difficult, the efficiency is low, Poor reusability. Java Server Faces (JSF) technology is precisely to solve this problem came into being, one of its most compelling features is that it is related to markup language, protocols, client devices. Visualize development with the support of the rapid development tool RAD with the reusable, extensible, component-based user interface framework provided by JSF. Now that JSF technology has been supported by many large vendors, such as the JSF Web UI of Sun, the JSF extension of IBM, and the ADF faces of Oracle, many open source projects also provide support for JSF technologies. At the same time, companies such as Oracle, Sun, Borland and IBM all provide a development environment for JSF.

problems existing in traditional JSP development

Implementation of the presentation layer and business layer separation, this is the Java EE Web application has been the ideal, unfortunately, JSP does not really achieve this goal. JSP is a Java-based Web user interface development standard technology, is a "scripted" development of the Web technology, in the JSP page confusing a large number of HTML for display logic and business logic for the Java code, so that page design and program development can not be separated JSP another larger flaw is that scripts cannot be reused, which often leads developers to copy-paste operations between JSP pages, resulting in multiple versions of the same piece of code, making debugging and design of the program extremely complex. and tag library taglib as a complement of JSP, the Java code from the JSP stripped, but also limited to achieve the performance and logic of the separation, never get rid of code and HTML page rub and the problem. In addition, JSP there are other inherent defects, such as the corresponding servlet compile error information is difficult to find in the JSP accurate error location, which brings great difficulty in debugging.

JSF Technology Introduction

The Java Server Faces (JSF) is a new standard Java framework for building Web applications on the Sun Java platform. It simplifies development by providing a component-centric approach to developing javaweb user interfaces. Enterprise developers and web designers will find that JSF development is simple enough to drag user interface (UI) components onto the page, and system developers will find that rich and robust JSF APIs provide them with unmatched functionality and programmatic flexibility.

JSF also ensures that applications are more maintainable by integrating well built model-view-controller (MVC) design patterns into its architecture.

JSF is a Web application framework standard developed by the Java Community Process (JCP). JSF has a well-defined request processing lifecycle and a rich component hierarchy designed to facilitate the simplicity of java-based Web user interface development. Leveraging the reusable, extensible, component-based user interface framework, supported by the rapid development tool RAD, enables visual editing of the Web user interface by dragging and dropping components, binding the components on the user interface to a data source, and handing the events generated by the client user interface to server-side processing , which greatly reduces the difficulty of Java based Web user interface development and improves the development efficiency.

In short, the main part of JSF is a GUI component framework and a flexible model for describing components across different markup languages or client devices. The JSF GUI component framework enables developers to create user interfaces for JSF applications.

JSF GUI components include standard HTML form controls such as buttons, layout components, and more complex components, such as datasheets. In addition, third parties can extend the basic classes defined in the specification to develop additional GUI components.

The architecture of the JSF component is designed so that the functionality of the component is defined by the component class, and the rendering of the component is defined by a separate renderer. The renderer defines how the component class is mapped to a component label that is appropriate for a particular customer.

One of the main advantages of JSF is that it is both a Java Web user interface Standard and a framework for strictly adhering to the model-view-controller (MVC) design pattern. A clear separation of user interface Code (view) from Application data and logic (models) makes JSF applications easier to manage. In order to prepare a JSF context for page access to application data and to prevent unauthorized or incorrect access to the page, all user interactions with the application are handled by a front-end controller. JSF technology achieves a complete separation of application logic and representations, and is a truly thorough MVC pattern.

The JSF technology now has a version of 1.1, the next version will be 1.2, and it will be released together with Java EE 5.0.

developing a JSF-based Web application step

JSF is a new standard Java framework for building Web applications that can be written by hand, based on JSF framework standards, to design Web user interfaces in textual fashion like HTML or JSP programs, and to build system platforms before development, running, and commissioning. The disadvantage of this is that it does not fully reflect the convenience and efficiency of visual development, which is typically used when analyzing the structure of a Web application.

Using RAD, the rapid development tool, is a prerequisite to achieving JSF visualization development. With the support of rapid development tools, the development, operation and debugging of Web applications conforming to JSF standards are implemented in the IDE environment, which greatly improves the efficiency of development and the whole process of development is fast and efficient. Many of the RAD tools supported by the company are now available, such as IBM's WebSphere Studio,oracle Company's JDeveloper, and Sun's Java Studio Creator, all of which provide support for JSF development.

If you do not use the IDE development environment, you must first build the system running platform before you develop your application. For example, install Tomcat and Sun's javaweb Services Developer Pack (JWSDP) 1.2. Using JSF, you need to jstl the Tag function library with JSF and put the required jar files in the Web-inf\lib directory of your Web application. If you use the IDE development environment, the preparation of early development is relatively simple, just install the IDE environment, no other configuration, the general IDE has embedded application server, enough to support the development, operation and debugging of the program. Whether or not you are using the IDE development environment, JSF development Web applications typically fall into the following three steps:

View Design

The easy and quick development of JSF based Web applications is achieved with JSF providing a rich set of reusable server-side user interface components. With the support of development tools, users can easily use these components to build a Web user interface in a visual environment, and handle user interface management issues such as data validation and event handling for components.

Design each desired JSP page, place JSF's built-in components in the page, and bind the component to the application-tier JavaBean. The RAD tool enables you to easily implement a paging file by dragging and dropping components without having to write a lot of code. The development tool automatically generates a page-corresponding Java file, where the JSF component of the page and its getter, setter methods, and the "action" attribute of the JSF component are defined in the file. Programmers can easily modify and debug on the basis of existing programs.

Model Design

JSF technology achieves a complete separation of application logic and representations. In the model design part, the programmer only needs to consider the logic function of the program, do not need to consider the data representation. The JSF model is implemented through the JavaBean program.

Controller Design

The JSF controller design is done in the configuration file, with two files associated with it: Web.xml files and Faces-config.xml files (all under the Web-inf directory). Web.xml files are primarily used to control the lifecycle of JSF and implement deployment descriptors. Faces-config.xml files to achieve navigation, in the file control between the page jump process.

The configuration step is to configure the Web.xml file for the Web application first, then the control file Faces-config.xml file that is configured for JSF. These two file formats are fixed, and this process is done automatically by the tool in the IDE environment, without the intervention of the designer, even if the manual configuration is simpler.

The technical focus of JSF is in the View section, which implements a complete separation of Web application design roles. JSF web designers only need to focus on the design of the page; application developers are primarily concerned with the development of the JavaBean in the Model section, and the Process control of the program is specifically configured by Faces-config.xml.

JSF is a reusable, extensible, component-based, tool-friendly, server-side UI Framework for Java-based Web application development. In the RAD development tool that supports JSF, people can build the Web user interface as quickly and easily as using visualstudio.net, which greatly reduces the difficulty of using Java technology to realize Web user interface and improves development efficiency.

JSF has a powerful component system and event processing system, fully implement the MVC pattern application architecture, make the Java-based Web user interface program development difficulty greatly reduced, improve the development efficiency, very suitable for Web page development.

JSF is an open standard with good scalability. In accordance with the JSF specification, users can customize their user interface components, event handlers, data validation and transformation modules, and so on, as reusable as standard JSF components. JSF APIs are directly built on the Servlet API, so the rendering of JSF user interface components is not limited to specific scripting techniques or markup languages. The presentation layer is fully capable of using a technology other than JSP. In many of the Java EE Performance Layer Framework technology, JSF shows its exuberant vitality. Although there are many problems with JSF technology, as the JSF technology continues to mature and version update, it will become more and more applications.



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.