Friday, March 18, 2011

JSF2 complete reference - again 4 - march18

<?xml version='1.0' encoding='UTF-8'?>
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://jsfcompref.com/example</namespace>
<tag>
<tag-name>helloworld</tag-name>
<component><component-type>HtmlHelloWorld</component-type></component>
</tag>
</facelet-taglib>

Now that we’ve created a simple, but fully functional component, we can begin adding
attributes to the component. Because HtmlHelloWorld extends from UIComponentBase,
UIComponent properties from the superclass such as id, binding, rendered are already
available for use in the Facelet page.

Prior to JSF 2.0, component state was typically stored in instance
variables on the UIComponent subclass. For example, the UIInput component has a valid
property, which indicates whether this component is valid or not. This value would be stored
in a simple boolean instance variable, accessed via a JavaBeans getter and setter and handled
explicitly in the saveState( ) and restoreState( ) methods. JSF 2.0 introduces the StateHelper
interface to make this sort of activity easier and less error prone.

No comments: