|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.
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. 25, 2015 10:00 AM EDT Reads: 4,197
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. 25, 2015 10:00 AM EDT Reads: 2,070
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. 25, 2015 09:45 AM EDT Reads: 1,748
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. 25, 2015 09:00 AM EDT Reads: 2,031
The worldwide cellular network will be the backbone of the future IoT, and the telecom industry is clamoring to get on board as more than just a data pipe. In his session at @ThingsExpo, Evan McGee, CTO of Ring Plus, Inc., discussed what service operators can offer that would benefit IoT entrepreneurs, inventors, and consumers. Evan McGee is the CTO of RingPlus, a leading innovative U.S. MVNO and wireless enabler. His focus is on combining web technologies with traditional telecom to create a new breed of unified communication that is easily accessible to the general consumer. With over a de...
May. 25, 2015 06:00 AM EDT Reads: 4,778
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. 25, 2015 05:00 AM EDT Reads: 6,047
Cloud is not a commodity. And no matter what you call it, computing doesn’t come out of the sky. It comes from physical hardware inside brick and mortar facilities connected by hundreds of miles of networking cable. And no two clouds are built the same way. SoftLayer gives you the highest performing cloud infrastructure available. One platform that takes data centers around the world that are full of the widest range of cloud computing options, and then integrates and automates everything. Join SoftLayer on June 9 at 16th Cloud Expo to learn about IBM Cloud's SoftLayer platform, explore se...
May. 25, 2015 04:45 AM EDT Reads: 3,263
SYS-CON Media announced today that 9 out of 10 " most read" DevOps articles are published by @DevOpsSummit Blog. Launched in October 2014, @DevOpsSummit Blog offers top articles, news stories, and blog posts from the world's well-known experts and guarantees better exposure for its authors than any other publication. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce softw...
May. 25, 2015 04:15 AM EDT Reads: 4,268
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. 25, 2015 04:00 AM EDT Reads: 2,913
15th Cloud Expo, which took place Nov. 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA, expanded the conference content of @ThingsExpo, Big Data Expo, and DevOps Summit to include two developer events. IBM held a Bluemix Developer Playground on November 5 and ElasticBox held a Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of Bluemix, its services and functionality and provide short-term introductory projects that developers can complete between sessions.
May. 25, 2015 04:00 AM EDT Reads: 6,416
From telemedicine to smart cars, digital homes and industrial monitoring, the explosive growth of IoT has created exciting new business opportunities for real time calls and messaging. In his session at @ThingsExpo, Ivelin Ivanov, CEO and Co-Founder of Telestax, shared some of the new revenue sources that IoT created for Restcomm – the open source telephony platform from Telestax. Ivelin Ivanov is a technology entrepreneur who founded Mobicents, an Open Source VoIP Platform, to help create, deploy, and manage applications integrating voice, video and data. He is the co-founder of TeleStax, a...
May. 25, 2015 04:00 AM EDT Reads: 6,523
The Internet of Things (IoT) promises to evolve the way the world does business; however, understanding how to apply it to your company can be a mystery. Most people struggle with understanding the potential business uses or tend to get caught up in the technology, resulting in solutions that fail to meet even minimum business goals. In his session at @ThingsExpo, Jesse Shiah, CEO / President / Co-Founder of AgilePoint Inc., showed what is needed to leverage the IoT to transform your business. He discussed opportunities and challenges ahead for the IoT from a market and technical point of vie...
May. 25, 2015 04:00 AM EDT Reads: 6,902
Grow your business with enterprise wearable apps using SAP Platforms and Google Glass. SAP and Google just launched the SAP and Google Glass Challenge, an opportunity for you to innovate and develop the best Enterprise Wearable App using SAP Platforms and Google Glass and gain valuable market exposure. In his session at @ThingsExpo, Brian McPhail, Senior Director of Business Development, ISVs & Digital Commerce at SAP, outlined the timeline of the SAP Google Glass Challenge and the opportunity for developers, start-ups, and companies of all sizes to engage with SAP today.
May. 25, 2015 03:00 AM EDT Reads: 5,137
The 3rd International @ThingsExpo, co-located with the 16th International Cloud Expo – to be held June 9-11, 2015, at the Javits Center in New York City, NY – is now accepting Hackathon proposals. Hackathon sponsorship benefits include general brand exposure and increasing engagement with the developer ecosystem. At Cloud Expo 2014 Silicon Valley, IBM held the Bluemix Developer Playground on November 5 and ElasticBox held the DevOps Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of...
May. 25, 2015 03:00 AM EDT Reads: 3,530
Enthusiasm for the Internet of Things has reached an all-time high. In 2013 alone, venture capitalists spent more than $1 billion dollars investing in the IoT space. With "smart" appliances and devices, IoT covers wearable smart devices, cloud services to hardware companies. Nest, a Google company, detects temperatures inside homes and automatically adjusts it by tracking its user's habit. These technologies are quickly developing and with it come challenges such as bridging infrastructure gaps, abiding by privacy concerns and making the concept a reality. These challenges can't be addressed w...
May. 25, 2015 02:45 AM EDT Reads: 6,837
The industrial software market has treated data with the mentality of “collect everything now, worry about how to use it later.” We now find ourselves buried in data, with the pervasive connectivity of the (Industrial) Internet of Things only piling on more numbers. There’s too much data and not enough information. In his session at @ThingsExpo, Bob Gates, Global Marketing Director, GE’s Intelligent Platforms business, to discuss how realizing the power of IoT, software developers are now focused on understanding how industrial data can create intelligence for industrial operations. Imagine ...
May. 25, 2015 02:00 AM EDT Reads: 5,351
SYS-CON Events announced today that Liaison Technologies, a leading provider of data management and integration cloud services and solutions, 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. Liaison Technologies is a recognized market leader in providing cloud-enabled data integration and data management solutions to break down complex information barriers, enabling enterprises to make smarter decisions, faster.
May. 25, 2015 01:30 AM EDT Reads: 5,456
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. 25, 2015 01:15 AM EDT Reads: 4,549
Hadoop as a Service (as offered by handful of niche vendors now) is a cloud computing solution that makes medium and large-scale data processing accessible, easy, fast and inexpensive. In his session at Big Data Expo, Kumar Ramamurthy, Vice President and Chief Technologist, EIM & Big Data, at Virtusa, will discuss how this is achieved by eliminating the operational challenges of running Hadoop, so one can focus on business growth. The fragmented Hadoop distribution world and various PaaS solutions that provide a Hadoop flavor either make choices for customers very flexible in the name of opti...
May. 25, 2015 12:30 AM EDT Reads: 4,033
Cultural, regulatory, environmental, political and economic (CREPE) conditions over the past decade are creating cross-industry solution spaces that require processes and technologies from both the Internet of Things (IoT), and Data Management and Analytics (DMA). These solution spaces are evolving into Sensor Analytics Ecosystems (SAE) that represent significant new opportunities for organizations of all types. Public Utilities throughout the world, providing electricity, natural gas and water, are pursuing SmartGrid initiatives that represent one of the more mature examples of SAE. We have s...
May. 24, 2015 11:00 PM EDT Reads: 6,159