JSF1.2的新特性

时间:2021-11-03 20:06:53

New in JSF 1.2

In this section we will go through some new features and changes in JSF 1.2 specification. JSF 1.1 was designed for JSP 1.2 and so could not take advantage of newer JSP features and JSP could not be changed to fill the needs of JSF. This resulted in a number of new features and changes. For ex.

  1. Unified Expression Language(EL) :
    Unified EL has been added to JSTL to overcome problems when integrating JSP EL with the JSF EL.EL was used to access data objects in a simple way. It is used mainly as a short-hand for accessing values. Later it was included in JSP 2.0 with more functionality.When JSF was released it also needed EL.JSF and JSP each has its own EL.The JSP EL is much flexibile to the web application developer but JSF people were unsatisfied by the JSP EL.One of the reason was that it requires JSP engine to evaluate expression at the appropriate time during the lifecycle, but JSP expressions are evaluated immediately. The second reason behind it was that JSP functions could only call static methods in TLD and they cannot be used to invoke public methods dynamically on server side objects during lifecycle to validate data and handle component evevts.
    So these were the reasons for developing such an EL that would work for both JSP and JSF and make using JSP and JSF together easier. This new EL is called unified EL. So this was inspired by EL used in JSTL and JSP. There is a package "el" in javax package that represents EL.

    In addition to the features already available in the JSP EL, unified EL has the following features :
    1.  Deferred evaluation of expressions i.e.evaluation of the expression at the appropriate time during the page lifecycle from JSP engine.
    2.  Support for expressions that can set and get values
    3.  Support for expressions that can invoke methods.
    4.  A pluggable API for resolving expressions
  2. Ajax Support :
    JSF framework can make things a little easier to write AJAXian JSF components.JSF allows to map different instances of the FacesServlet with different lifecycles.For example, one mapping for standard JSF requests and another for AJAX JSF requests.
  3. New Tree Creation and Content Interweaving Model for Faces applications that use JSP :
    We can make JSF application without using any JSP page but it can also be developed using both JSP and JSF.Using JSP makes some developers easy to handle.Sometimes When integrated it did not respond as we expect. These problems have been resolved in JSF 1.2.There have been made some changes in specification of the implementation of the FacesViewHandler for JSP and JSP custom tag base class.
  4. Integration with JSTL :
    Using JSTL's <c:forEach> tag to contain Faces input components was one of the problem, because JSP has no notion of a postback, it was not possible to apply the values correctly to the nested input components on postback. Some new concepts in EL make it possible to use this tag fully with any kind of JSF component.
  5. Back Button issues and Multi Frame or Multi Window Faces Apps :
    JSF have fixed the problem related to Multi Frame or Multi Window applications.The browser back button also created some problems. These problems were because of deficiency in the State Management API.
  6. Associating a message with a particular component in the page :
    Previously we could not include label of a component dynamically in an error message for that component. Now it's possible in new JSF 1.2.It's also possible to override the conversion or validation message that is displayed to the user on a per-instance basis.
  7. Expose an application wide ResourceBundle to the EL :
    <resource-bundle> element in faces-config allows listing many resource bundles that should be exposed to the EL using the new ELResolver chain.This optimize performance and prevent the need to create a ResourceBundle for every request.
  8. Use of multiple renderKits.
  9. Provide XML Schema for the config files, instead of using DTD.
  10. Security enhancements for client side state saving.
  11. Solve the "duplicate button press" problem.
  12. The portlet related bug-fixes.