|By Deepak Vohra||
|September 1, 2011 01:00 PM EDT||
JavaServer Faces (JSF) technology is used for developing server-side user interfaces (UI) for Java EE applications. JSF 2.0 architecture has introduced several new features, most of which we shall discuss in this article. The salient new features in JSF 2.0 are State Saving, Facelets, Navigation, Validations, Scopes, AJAX, Resource Handling, Composite Components, View Params, Client Behaviors, Event Handling, and Exception Handling.
In JSF 1.2 the full component tree is saved/restored. Attributes are also stored and restored. Saving and restoring the full state has performance and memory issues as the complete state has to be saved and restored and the size of the state saved could be large. In JSF 1.2 each UIComponent saves/restores its own state in the component hierarchy using saveState and resoreState methods in StateHolder. If state saving were to be optimized, it would have to be added to each component class in the hierarchy.
JSF 2.0 has introduced partial state saving in which the initial state of the component tree is marked and only the delta state changes due to modifications are saved, which makes the size of the state saved small. Re-executing the view and subsequently updating with the saved delta state change restores the component tree. Instead of implementing the StateHolder interface, components in JSF 2.0 implement the PartialStateHolder interface, which provides the partial state feature. PartialStateHolder provides methods shown in Table 1.
To make it easier for UIComponents to implement PartialSatetHolder the StateHelper, which is a Map-like interface with methods such as add, eval, get, put, remove, is provided to store a component's state such as attributes and listeners. Partial state saving makes the size of the state saved about four times smaller. As the state is restored by re-executing the view, restoring of the component tree could take more time than in JSF 1.2.
By default, JSF 2.0 uses partial state saving. The javax.faces.PARTIAL_STATE_SAVING context-param is provided turn off/on partial state saving. The partial state saving param may be changed using the PARTIAL_STATE_SAVING_PARAM_NAME param.
To implement state saving, JSF 2.0 has introduced tree visiting. In JSF 1.2 only one component could be invoked in a single tree traversal using the UIComponent.invokeOnComponent() method. If multiple components are required to be invoked as in an AJAX request or state saving, multiple tree traversals have to applied. With the tree visiting, multiple components may be invoked in a single tree traversal. Tree visiting is implemented using the visitTree(VisitContext context,VisitCallback callback) method. VisitContext is a context object that holds state for component tree visit. VisitCallback is an interface to visit a specified UIComponent in tree visit.
JSF 1.2 used the JSP view technology. JSF 2.0 uses the Facelets view definition language (VDL) as the default view rendering technology. Facelets is an extension to JavaServer Faces (JSF) and uses XHTML syntax to define a JSF page. Facelets are XHTML pages and by default use the .xhtml extension. The default Facelets suffix is specified by the DEFAULT_FACELETS_SUFFIX context parameter. The Facelets view handler in JSF 1.2 had to be specified in faces-config.xml with the following configuration:
In JSF 2.0 a view handler is not configured and the default view handler javax.faces.application.ViewHandler is used. The default faces-config.xml for Facelets in JSF 2.0 is an empty file. The default value of the DEFAULT_FACELETS_SUFFIX constant in the ViewHandler view handler is .xhtml. Other Facelets view mappings(view pages to be interpreted as Facelets) may be specified using the javax.faces.FACELETS_VIEW_MAPPINGS context parameter:
Navigation in JSF 1.2 is configured using navigation rules based on outcomes from a view id in faces-config.xml. For example, to navigate to output.jsp if the outcome from input.jsp is "success" and to navigate to error.jsp if the outcome is "error", specify the following navigation rule in faces-config.xml:
JSF 2.0 has simplified navigation with the introduction of implicit navigation with which the navigation is based on the outcome. Implicitly the JSF application navigates to a view id with the same name as the outcome. For example, if the outcome is "output", the navigation handler navigates to output.xhtml, if provided. JSF 2.0 has also introduced conditional navigation with which the navigation handler navigates to a view id based on a condition EL expression specified in faces-config.xml. JSF 2.0 has also introduced the ConfigurableNavigationHandler class for configuring navigation programmatically. Preemptive navigation is another new feature used to determine the destination URL based on outcome. The new components h:button and h:link support preemptive navigation.
Validation in JSF 1.2 is implemented using built-in validators f:validateDoubleRange (for a double value with an optional range), f:validateLongRange(a long value with an optional range), and f:validateLength (a String with a minimum and maximum number of characters). JSF 1.2 also supports custom validators with the f:validator tag and the javax.faces.validator.Validator interface. JSF 1.2 did not have built-in provisions for empty field validation and validation with regular expressions.
JSF 2.0 has introduced validation of empty fields, which is also available for custom validators. Three new built-in validators have been added: f:validateRegex for regular expressions, f:validateRequired for required field, and f:validateBean for Bean validation, which is another new feature. Bean validation is implemented in conjunction with validation constrain annotations, which are defined in the javax.validation.constraints package. Validation constraint annotations annotate managed bean properties. For example the @Size annotation constrains size, and the @Pattern annotation requires conformance with a regular expression. Bean validation is supported with custom validators also.
Scopes and Configuration
As mentioned earlier the faces-config.xml in JSF 2.0 is an empty file. JSF 1.2 faces-config.xml has configuration for managed beans, managed bean properties, scopes, validators, converters, and renderers. JSF 2.0 has introduced annotations-based configuration for managed beans, managed bean properties, scopes, validators, converters, and renderers. New scopes: view, flash, and custom have been added for finer-grained scopes. JSF 2.0 has added a new configuration project stage that indicates the state of a project.
JSF 1.2 did not provide built-in support for AJAX, and an AJAX framework such as Ajax4jsf had to be used. Or AJAX had to be implemented with the XMLHttpRequest object without any framework. JSF 2.0 has added support for AJAX with the f:ajax tag, which includes support for partial page rendering and grouped components. AJAX support may also be added using the AJAX JSF library.
JSF 2.0 has introduced a Composite Components tag library for creating composite components. A Composite component is a composite (collection) of other UI components. A composite component consists of a library, which makes use of the new resource handling feature, a definition page, and a using page, which are based on Facelets. A definition page defines a composite component and a using page makes use of a composite component.
JSF 1.2 includes support for sending parameters only in a POST request. View parameters add the provision to send request parameters in a GET request. View parameters are configured in the f:metadata tag using the f:viewParam tags. View params are EditableValueHolder components and may configured with validators and converters just as other EditableValueHolder components such as h:inputText. View parameters also support component system events using the f:event tag. Preemptive navigation, which was mentioned in the Navigation section, and bookmarking is made feasible with view params. View params may also be used with Faces redirects.
Behaviors are objects attached to components to provide additional functionality. Client behaviors are an implementation of behaviors with which scripts may be attached with components to be run from client-side events. A Facelet taglib is required for a client behavior. Client behaviors are added to a Facelets page using tags from the Facelets taglib.
Event Handling and Exception Handling
JSF 2.0 has introduced a new type of events called system events. System events are of two types: application scoped system events and component system events. System events are similar to, but with more precise granularity, to phase events. For event handling in an AJAX request the f:ajax tag includes a onevent attribute to register a callback Java Script function.
ExceptionHandler is a new class to handle unexpected exceptions. The f:ajax tag includes a onerror attribute for error handling callback function.
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at Internet of @ThingsExpo, James Kirkland, Chief Architect for the Internet of Things and Intelligent Systems at Red Hat, described how to revolutioniz...
May. 22, 2015 02:00 PM EDT Reads: 4,491
For IoT to grow as quickly as analyst firms’ project, a lot is going to fall on developers to quickly bring applications to market. But the lack of a standard development platform threatens to slow growth and make application development more time consuming and costly, much like we’ve seen in the mobile space. In his session at @ThingsExpo, Mike Weiner is Product Manager of the Omega DevCloud with KORE Telematics Inc., will discuss the evolving requirements for developers as IoT matures and conduct a live demonstration of how quickly application development can happen when the need to comply...
May. 22, 2015 01:00 PM EDT Reads: 1,480
SYS-CON Events announced today that DragonGlass, an enterprise search platform, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. After eleven years of designing and building custom applications, OpenCrowd has launched DragonGlass, a cloud-based platform that enables the development of search-based applications. These are a new breed of applications that utilize a search index as their backbone for data retrieval. They can easily adapt to new data sets and provide access to both structured and unstruc...
May. 22, 2015 12:00 PM EDT Reads: 1,565
Converging digital disruptions is creating a major sea change - Cisco calls this the Internet of Everything (IoE). IoE is the network connection of People, Process, Data and Things, fueled by Cloud, Mobile, Social, Analytics and Security, and it represents a $19Trillion value-at-stake over the next 10 years. In her keynote at @ThingsExpo, Manjula Talreja, VP of Cisco Consulting Services, will discuss IoE and the enormous opportunities it provides to public and private firms alike. She will share what businesses must do to thrive in the IoE economy, citing examples from several industry sector...
May. 22, 2015 12:00 PM EDT Reads: 1,712
Container frameworks, such as Docker, provide a variety of benefits, including density of deployment across infrastructure, convenience for application developers to push updates with low operational hand-holding, and a fairly well-defined deployment workflow that can be orchestrated. Container frameworks also enable a DevOps approach to application development by cleanly separating concerns between operations and development teams. But running multi-container, multi-server apps with containers is very hard. You have to learn five new and different technologies and best practices (libswarm, sy...
May. 22, 2015 12:00 PM EDT Reads: 1,631
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo in Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 17th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal an...
May. 22, 2015 11:30 AM EDT Reads: 2,245
The security devil is always in the details of the attack: the ones you've endured, the ones you prepare yourself to fend off, and the ones that, you fear, will catch you completely unaware and defenseless. The Internet of Things (IoT) is nothing if not an endless proliferation of details. It's the vision of a world in which continuous Internet connectivity and addressability is embedded into a growing range of human artifacts, into the natural world, and even into our smartphones, appliances, and physical persons. In the IoT vision, every new "thing" - sensor, actuator, data source, data con...
May. 22, 2015 11:00 AM EDT Reads: 6,038
SYS-CON Events announced today that the "First Containers & Microservices Conference" will take place June 9-11, 2015, at the Javits Center in New York City. The “Second Containers & Microservices Conference” will take place November 3-5, 2015, at Santa Clara Convention Center, Santa Clara, CA. Containers and microservices have become topics of intense interest throughout the cloud developer and enterprise IT communities.
May. 22, 2015 10:00 AM EDT Reads: 1,701
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists will peel away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud environment, and we must architect and code accordingly. At the very least, you'll have no problem fil...
May. 22, 2015 10:00 AM EDT Reads: 1,601
IoT is still a vague buzzword for many people. In his session at @ThingsExpo, Mike Kavis, Vice President & Principal Cloud Architect at Cloud Technology Partners, discussed the business value of IoT that goes far beyond the general public's perception that IoT is all about wearables and home consumer services. He also discussed how IoT is perceived by investors and how venture capitalist access this space. Other topics discussed were barriers to success, what is new, what is old, and what the future may hold. Mike Kavis is Vice President & Principal Cloud Architect at Cloud Technology Pa...
May. 22, 2015 10:00 AM EDT Reads: 7,472
Disruptive macro trends in technology are impacting and dramatically changing the "art of the possible" relative to supply chain management practices through the innovative use of IoT, cloud, machine learning and Big Data to enable connected ecosystems of engagement. Enterprise informatics can now move beyond point solutions that merely monitor the past and implement integrated enterprise fabrics that enable end-to-end supply chain visibility to improve customer service delivery and optimize supplier management. Learn about enterprise architecture strategies for designing connected systems tha...
May. 22, 2015 10:00 AM EDT Reads: 5,736
There's Big Data, then there's really Big Data from the Internet of Things. IoT is evolving to include many data possibilities like new types of event, log and network data. The volumes are enormous, generating tens of billions of logs per day, which raise data challenges. Early IoT deployments are relying heavily on both the cloud and managed service providers to navigate these challenges. In her session at Big Data Expo®, Hannah Smalltree, Director at Treasure Data, discussed how IoT, Big Data and deployments are processing massive data volumes from wearables, utilities and other machines...
May. 22, 2015 10:00 AM EDT Reads: 3,823
SYS-CON Events announced today that MetraTech, now part of Ericsson, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Ericsson is the driving force behind the Networked Society- a world leader in communications infrastructure, software and services. Some 40% of the world’s mobile traffic runs through networks Ericsson has supplied, serving more than 2.5 billion subscribers.
May. 22, 2015 09:45 AM EDT Reads: 786
The 4th International Internet of @ThingsExpo, co-located with the 17th International Cloud Expo - to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA - announces that its Call for Papers is open. The Internet of Things (IoT) is the biggest idea since the creation of the Worldwide Web more than 20 years ago.
May. 22, 2015 09:00 AM EDT Reads: 1,185
The 17th International Cloud Expo has announced that its Call for Papers is open. 17th International Cloud Expo, to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, APM, APIs, Microservices, Security, Big Data, Internet of Things, DevOps and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal today!
May. 22, 2015 08:00 AM EDT Reads: 3,941
The explosion of connected devices / sensors is creating an ever-expanding set of new and valuable data. In parallel the emerging capability of Big Data technologies to store, access, analyze, and react to this data is producing changes in business models under the umbrella of the Internet of Things (IoT). In particular within the Insurance industry, IoT appears positioned to enable deep changes by altering relationships between insurers, distributors, and the insured. In his session at @ThingsExpo, Michael Sick, a Senior Manager and Big Data Architect within Ernst and Young's Financial Servi...
May. 22, 2015 06:00 AM EDT Reads: 4,483
The recent trends like cloud computing, social, mobile and Internet of Things are forcing enterprises to modernize in order to compete in the competitive globalized markets. However, enterprises are approaching newer technologies with a more silo-ed way, gaining only sub optimal benefits. The Modern Enterprise model is presented as a newer way to think of enterprise IT, which takes a more holistic approach to embracing modern technologies.
May. 22, 2015 06:00 AM EDT Reads: 5,810
Since 2008 and for the first time in history, more than half of humans live in urban areas, urging cities to become “smart.” Today, cities can leverage the wide availability of smartphones combined with new technologies such as Beacons or NFC to connect their urban furniture and environment to create citizen-first services that improve transportation, way-finding and information delivery. In her session at @ThingsExpo, Laetitia Gazel-Anthoine, CEO of Connecthings, will focus on successful use cases.
May. 22, 2015 06:00 AM EDT Reads: 4,651
17th Cloud Expo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterprises are using some form of XaaS – software, platform, and infrastructure as a service.
May. 22, 2015 05:00 AM EDT Reads: 2,062
One of the biggest impacts of the Internet of Things is and will continue to be on data; specifically data volume, management and usage. Companies are scrambling to adapt to this new and unpredictable data reality with legacy infrastructure that cannot handle the speed and volume of data. In his session at @ThingsExpo, Don DeLoach, CEO and president of Infobright, will discuss how companies need to rethink their data infrastructure to participate in the IoT, including: Data storage: Understanding the kinds of data: structured, unstructured, big/small? Analytics: What kinds and how responsiv...
May. 22, 2015 05:00 AM EDT Reads: 4,203