|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.
Scott Jenson leads a project called The Physical Web within the Chrome team at Google. Project members are working to take the scalability and openness of the web and use it to talk to the exponentially exploding range of smart devices. Nearly every company today working on the IoT comes up with the same basic solution: use my server and you'll be fine. But if we really believe there will be trillions of these devices, that just can't scale. We need a system that is open a scalable and by using the URL as a basic building block, we open this up and get the same resilience that the web enjoys.
Nov. 25, 2014 09:30 PM EST Reads: 1,000
The Internet of Things is tied together with a thin strand that is known as time. Coincidentally, at the core of nearly all data analytics is a timestamp. When working with time series data there are a few core principles that everyone should consider, especially across datasets where time is the common boundary. In his session at Internet of @ThingsExpo, Jim Scott, Director of Enterprise Strategy & Architecture at MapR Technologies, discussed single-value, geo-spatial, and log time series data. By focusing on enterprise applications and the data center, he will use OpenTSDB as an example t...
Nov. 25, 2014 09:30 PM EST Reads: 1,038
P2P RTC will impact the landscape of communications, shifting from traditional telephony style communications models to OTT (Over-The-Top) cloud assisted & PaaS (Platform as a Service) communication services. The P2P shift will impact many areas of our lives, from mobile communication, human interactive web services, RTC and telephony infrastructure, user federation, security and privacy implications, business costs, and scalability. In his session at @ThingsExpo, Robin Raymond, Chief Architect at Hookflash, will walk through the shifting landscape of traditional telephone and voice services ...
Nov. 25, 2014 08:00 PM EST Reads: 1,333
The Domain Name Service (DNS) is one of the most important components in networking infrastructure, enabling users and services to access applications by translating URLs (names) into IP addresses (numbers). Because every icon and URL and all embedded content on a website requires a DNS lookup loading complex sites necessitates hundreds of DNS queries. In addition, as more internet-enabled ‘Things' get connected, people will rely on DNS to name and find their fridges, toasters and toilets. According to a recent IDG Research Services Survey this rate of traffic will only grow. What's driving t...
Nov. 25, 2014 07:00 PM EST Reads: 1,146
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...
Nov. 25, 2014 04:30 PM EST Reads: 1,201
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...
Nov. 24, 2014 07:00 PM EST Reads: 1,572
Bit6 today issued a challenge to the technology community implementing Web Real Time Communication (WebRTC). To leap beyond WebRTC’s significant limitations and fully leverage its underlying value to accelerate innovation, application developers need to consider the entire communications ecosystem.
Nov. 24, 2014 12:00 PM EST Reads: 1,445
The definition of IoT is not new, in fact it’s been around for over a decade. What has changed is the public's awareness that the technology we use on a daily basis has caught up on the vision of an always on, always connected world. If you look into the details of what comprises the IoT, you’ll see that it includes everything from cloud computing, Big Data analytics, “Things,” Web communication, applications, network, storage, etc. It is essentially including everything connected online from hardware to software, or as we like to say, it’s an Internet of many different things. The difference ...
Nov. 24, 2014 11:00 AM EST Reads: 1,584
Cloud Expo 2014 TV commercials will feature @ThingsExpo, which was launched in June, 2014 at New York City's Javits Center as the largest 'Internet of Things' event in the world.
Nov. 24, 2014 09:00 AM EST Reads: 1,599
SYS-CON Events announced today that Windstream, a leading provider of advanced network and cloud communications, 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. Windstream (Nasdaq: WIN), a FORTUNE 500 and S&P 500 company, is a leading provider of advanced network communications, including cloud computing and managed services, to businesses nationwide. The company also offers broadband, phone and digital TV services to consumers primarily in rural areas.
Nov. 23, 2014 07:30 PM EST Reads: 1,786
"There is a natural synchronization between the business models, the IoT is there to support ,” explained Brendan O'Brien, Co-founder and Chief Architect of Aria Systems, in this SYS-CON.tv interview at the 15th International Cloud Expo®, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Nov. 23, 2014 12:00 PM EST Reads: 1,726
The major cloud platforms defy a simple, side-by-side analysis. Each of the major IaaS public-cloud platforms offers their own unique strengths and functionality. Options for on-site private cloud are diverse as well, and must be designed and deployed while taking existing legacy architecture and infrastructure into account. Then the reality is that most enterprises are embarking on a hybrid cloud strategy and programs. In this Power Panel at 15th Cloud Expo (http://www.CloudComputingExpo.com), moderated by Ashar Baig, Research Director, Cloud, at Gigaom Research, Nate Gordon, Director of T...
Nov. 23, 2014 07:45 AM EST Reads: 1,738
An entirely new security model is needed for the Internet of Things, or is it? Can we save some old and tested controls for this new and different environment? In his session at @ThingsExpo, New York's at the Javits Center, Davi Ottenheimer, EMC Senior Director of Trust, reviewed hands-on lessons with IoT devices and reveal a new risk balance you might not expect. Davi Ottenheimer, EMC Senior Director of Trust, has more than nineteen years' experience managing global security operations and assessments, including a decade of leading incident response and digital forensics. He is co-author of t...
Nov. 22, 2014 05:30 PM EST Reads: 1,482
ARMONK, N.Y., Nov. 20, 2014 /PRNewswire/ -- IBM (NYSE: IBM) today announced that it is bringing a greater level of control, security and flexibility to cloud-based application development and delivery with a single-tenant version of Bluemix, IBM's platform-as-a-service. The new platform enables developers to build ap...
Nov. 22, 2014 05:30 PM EST Reads: 1,545
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...
Nov. 21, 2014 08:00 PM EST Reads: 1,474
Technology is enabling a new approach to collecting and using data. This approach, commonly referred to as the "Internet of Things" (IoT), enables businesses to use real-time data from all sorts of things including machines, devices and sensors to make better decisions, improve customer service, and lower the risk in the creation of new revenue opportunities. In his General Session at Internet of @ThingsExpo, Dave Wagstaff, Vice President and Chief Architect at BSQUARE Corporation, discuss the real benefits to focus on, how to understand the requirements of a successful solution, the flow of ...
Nov. 21, 2014 08:00 PM EST Reads: 1,549
"BSQUARE is in the business of selling software solutions for smart connected devices. It's obvious that IoT has moved from being a technology to being a fundamental part of business, and in the last 18 months people have said let's figure out how to do it and let's put some focus on it, " explained Dave Wagstaff, VP & Chief Architect, at BSQUARE Corporation, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Nov. 21, 2014 07:00 PM EST Reads: 1,405
Focused on this fast-growing market’s needs, Vitesse Semiconductor Corporation (Nasdaq: VTSS), a leading provider of IC solutions to advance "Ethernet Everywhere" in Carrier, Enterprise and Internet of Things (IoT) networks, introduced its IStaX™ software (VSC6815SDK), a robust protocol stack to simplify deployment and management of Industrial-IoT network applications such as Industrial Ethernet switching, surveillance, video distribution, LCD signage, intelligent sensors, and metering equipment. Leveraging technologies proven in the Carrier and Enterprise markets, IStaX is designed to work ac...
Nov. 20, 2014 09:15 PM EST Reads: 1,455
C-Labs LLC, a leading provider of remote and mobile access for the Internet of Things (IoT), announced the appointment of John Traynor to the position of chief operating officer. Previously a strategic advisor to the firm, Mr. Traynor will now oversee sales, marketing, finance, and operations. Mr. Traynor is based out of the C-Labs office in Redmond, Washington. He reports to Chris Muench, Chief Executive Officer. Mr. Traynor brings valuable business leadership and technology industry expertise to C-Labs. With over 30 years' experience in the high-tech sector, John Traynor has held numerous...
Nov. 20, 2014 06:00 PM EST Reads: 1,396
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 - announces that it is now accepting Keynote Proposals. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - computers, smartphones, tablets, and sensors - connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades.
Nov. 20, 2014 01:00 PM EST Reads: 1,674