facelets tag reference

49
Facelets Tag Reference T his appendix describes all of the tags available in the Facelets library and explains each one’s attributes. <ui:component/> The ui:component tag inserts a new UIComponent instance into the JavaServer Faces tree as the root of all the components or content fragments it contains. Table A-1 shows its attributes. Table A-1. UI Component Attributes Attribute Name Required Description id No As with any component, an id can be provided. If none is present, Facelets will create an id following the JavaServer Specification rules. binding No Following the JavaServer Faces Specification, this attribute can be used to reference a UIComponent instance by pointing to a property of managed bean. The instance will be lazily created if the property did not have an instance assigned already. Everything outside of this component’s tags will be ignored by the compiler and won’t appear on the rendered view: This and everything before this will be ignored. <ui:component binding="#{backingBean.myComponent}"> <div>The directory contains #{totalBirds} birds!</div> </ui:component> This and everything after this will be ignored. The preceding code will produce this HTML output: <div>The directory contains 214 birds!</div> 271 APPENDIX A

Upload: khangminh22

Post on 06-Mar-2023

1 views

Category:

Documents


0 download

TRANSCRIPT

Facelets Tag Reference

This appendix describes all of the tags available in the Facelets library and explains each one’sattributes.

<ui:component/>The ui:component tag inserts a new UIComponent instance into the JavaServer Faces tree as theroot of all the components or content fragments it contains. Table A-1 shows its attributes.

Table A-1. UI Component Attributes

Attribute Name Required Description

id No As with any component, an id can be provided. If none is present,Facelets will create an id following the JavaServer Specificationrules.

binding No Following the JavaServer Faces Specification, this attribute can beused to reference a UIComponent instance by pointing to a propertyof managed bean. The instance will be lazily created if the propertydid not have an instance assigned already.

Everything outside of this component’s tags will be ignored by the compiler and won’tappear on the rendered view:

This and everything before this will be ignored.<ui:component binding="#{backingBean.myComponent}"><div>The directory contains #{totalBirds} birds!</div>

</ui:component>This and everything after this will be ignored.

The preceding code will produce this HTML output:

<div>The directory contains 214 birds!</div>

271

A P P E N D I X A

<ui:composition/>The ui:composition tag is a templating tag used to encapsulate content that can be includedin other Facelets pages. Table A-2 shows its attribute.

Table A-2. UI Composition Attribute

Attribute Name Required Description

template No The path to the template that will be populated by the contentbetween the starting and ending composition tag.

This tag is a fundamental piece in Facelets and is based in the idea of compositions.The UIComponent tree may be formed by compositions described in different pages acrossthe application. Like the ui:component tag, everything before and after the composition tagwill be removed; the difference between these two tags is that ui:composition does not cre-ate a component in the tree. The ui:composition content can be included in your view orother compositions, and when this happens, all the components contained by the com-position will be added directly to the component tree.

This and everything before this will be ignored.<ui:composition><h:outputText value="#{bird.lifeExpectancy}" />

</ui:composition>

This and everything after this will be ignored.

We can use the composition tag to populate a template, as shown in the example fromthe “Creating JSF Views” section in Chapter 3. We could use something like this:

<ui:composition template="bird-template.xhtml"><ui:define name="summary">

<h:panelGrid columns="2"><h:outputText value="Bird Name"/><h:outputText value="#{bird.name}"/><h:outputText value="Life expectancy"/>

<h:outputTextvalue="#{bird.lifeExpectancy}"/>

</h:panelGrid></ui:define>

</ui:composition>

The content within the composition tag would be used to populate the ui:insert tagwith name "summary" from the bird-template.xhtml template.

The key components where creating composite views with Facelets are theui:composition, ui:define, and ui:insert tags. The latter two are explained later in thisappendix.

APPENDIX A ■ FACELETS TAG REFERENCE272

<ui:debug/>The debug tag is a very useful tool when developing an application. It can be launched usingthe combination Ctrl + Shift + <hotkey> (D, by default) while browsing your Facelets applica-tion. It will display a pop-up window that shows the component tree and the scoped variables.Table A-3 shows its attributes.

Table A-3. UI Debug Attributes

Attribute Name Required Description

hotkey No Pressing Ctrl + Shift + <hotkey> will display the Facelets debugwindow. This attribute cannot be an EL expression. The defaultvalue is d.

rendered No Following the JavaServer Faces Specification, this attribute mustevaluate to a Boolean value. If it is false, the script needed to launchthe debug window won’t be present in the page.

Conventionally, the debug tag can be found at the end of the pages, but it can be used any-where. We can use the debug tag as follows:

<ui:debug hotkey="g"rendered="#{initParam['apress.DEBUG_MODE']}"/>

In this case, the debug window will be launched when pressing Ctrl + Shift + G andwould be rendered if our init parameter with name apress.DEBUG_MODE is set to true. Usu-ally, we don’t want the debug script rendered when in production, so it is convenient to havea single point of configuration (like in the previous example), so we can enable or disable alldebug tags.

<ui:decorate/>The ui:decorate tag is similar to the ui:composition tag, the only difference being that thedecorate tag does not remove everything outside of it. As its name implies, you can use thistag to add some content around the decorated section by using a template. Table A-4 showsits attribute.

Table A-4. UI Decorate Attribute

Attribute Name Required Description

template Yes The path to the template that will be populated by the contentbetween the start and end of the decorate tag

For instance, we would have a template that wraps the content of the decorate tag in abox creating using div elements, like the one in Listing A-1.

APPENDIX A ■ FACELETS TAG REFERENCE 273

Listing A-1. box-template.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD ➥

XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/ ➥

xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets"><body>

<ui:composition><div style="border: 1px solid black; display:block">

<ui:insert name="header"/></div><div style="border: 1px solid black; display:block">

<ui:insert name="content"/></div>

</ui:composition></body></html>

Once we have the template, we could use the decorate tag as shown in Listing A-2.

Listing A-2. decorate-example.xhtml

<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/ ➥

xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:h="http://java.sun.com/jsf/html">

<head><title>Decorate example</title>

</head><body>

<p>These are the birds in today's menu:</p>

<ui:decorate template="box-template.xhtml"><ui:define name="header">

Happy Parrot</ui:define><ui:define name="content">

How many parrots do you want?<h:inputText value="3"/>

</ui:define></ui:decorate><br/>

APPENDIX A ■ FACELETS TAG REFERENCE274

<ui:decorate template="box-template.xhtml"><ui:define name="header">

Mighty Eagle</ui:define><ui:define name="content">

Eagles are not available now.</ui:define>

</ui:decorate></body>

</html>

In the preceding listing, we would create a page and include two boxes with bird infor-mation. Everything outside the page will be rendered in the final page, and we would endup with HTML output like the following:

<html xmlns="http://www.w3.org/1999/xhtml"><head>

<title>Decorate example</title></head><body>

<p>These are the birds in today's menu:</p><div style="border: 1px solid black; display:block">

Happy Parrot</div><div style="border: 1px solid black; display:block">

How many parrots do you want?<input id="_id6" name="_id6"

type="text" value="3" /></div>

<br/><div style="border: 1px solid black; display:block">

Mighty Eagle</div>

<div style="border: 1px solid black; display:block">Eagles are not available now.

</div>

As you can see in the rendered page, the div elements that create the boxes frame thecontent defined in the decorate tag.

Note too that the template uses ui:composition tags to trim everything outside them.Otherwise, when we used this template with a decorate tag, the HTML and body tags wouldbe repeated in the final output.

APPENDIX A ■ FACELETS TAG REFERENCE 275

<ui:define/>The ui:define templating tag can be used to insert named content into a template. It can beused within tags that allow templating, such as the ui:composition and ui:decorate tags. Thenames used in the define tag must match the names used in the ui:insert tags in the targettemplate. Table A-5 shows its attribute.

Table A-5. UI Define Attribute

Attribute Name Required Description

name Yes This mandatory attribute specifies the literal name of the defini-tion. It must match with the name of a ui:insert tag in the targettemplate.

Let’s take a look at the following snippet:

<ui:decorate template="box-template.xhtml"><ui:define name="header">

Happy Parrot</ui:define>

this will be removed

<ui:define name="content">How many parrots do you want?

</ui:define></ui:decorate>

The template used by this snippet contains insert tags, named "header" and "content".The code within the define tags will be inserted in those areas, matching by name.

The content outside the define tags will be ignored by the Facelets compiler.Listing A-3 illustrates the define tag in action.

Listing A-3. define-template.xhtml

<h:outputText value="Which bird sings like this? "/><ui:insert name="song"/>define-example.xhtmlThis will be ignored<ui:composition template="define-template.xhtml">

<ui:define name="song"><h:outputText value="cock-a-doodle-doo"/>

</ui:define></ui:composition>

This example will render:

Which bird sings like this? cock-a-doodle-doo

APPENDIX A ■ FACELETS TAG REFERENCE276

<ui:fragment/>The ui:fragment tag is similar to the ui:component tag, but the fragment tag does not trim thecontent outside itself. Table A-6 shows its attributes.

Table A-6. UI Fragment Attributes

Attribute Name Required Description

id No As with any component, an id can be provided. If none is present,Facelets will create an id following the JavaServer Faces Specifi-cation rules.

binding No Following the JavaServer Specification, this attribute can be used toreference a UIComponent instance by pointing to a property of man-aged bean. The instance will be lazily created if the property did nothave an instance assigned already.

The fragment tag inserts a new UIComponent instance into the component tree, and anyother components or content fragments outside the tag will still be included at compile time.All elements with the fragment tag will be added as children of the component instance.

This will be ignored<ui:fragment>

<div><h:outputText

value="I want #{eagle.total} eagles."/></div>

</ui:fragment>This will be ignored

This will create the following output:

This will be ignored<div>I want 3 eagles.</div>

This will be ignored

<ui:include/>The ui:include tag can be used to include another Facelets file into your document. Itsimply includes whatever source file you specify. You can include any Facelets file that hasui:component or ui:composition tags (which trim the content outside themselves) or afragment of XHTML or XML. Table A-7 shows its attribute.

Table A-7. UI Include Attribute

Attribute Name Required Description

src Yes This attribute can be a literal value or an EL expression that declaresthe target Facelets to be included in the document.

APPENDIX A ■ FACELETS TAG REFERENCE 277

The path in the src attribute can be absolute or relative. If it is relative, it will be resolvedagainst the original Facelets instance that was requested.

<div><ui:include src="#{backingBean.currentMenu}"/>

</div>

In this example, the expression #{backingBean.currentMenu} will be resolved to a file path.This can be used to include content dynamically depending on the context.

<ui:insert/>The ui:insert tag is used to specify in a template those areas that can be replaced byui:define tags declared in the client template. Table A-8 shows its attribute.

Table A-8. UI Insert Attribute

Attribute Name Required Description

name No This name will be use to match the insert tag with the same namein the client for the template. If no name is specified, the wholeclient template will be inserted.

The insert tag can contain nested content. If it does, and no define tag is specified in theclient that matches the name of the insert tag, the nested content will be inserted. It can beused to insert default content when the define tag is not specified.

Let’s take a look at the example in Listing A-4.

Listing A-4. insert-template.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/ ➥

xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets"><body>

<h1><ui:insert name="title">

No title</ui:insert>

</h1>

<div><ui:insert name="content">

No content is defined</ui:insert>

</div></body></html>

APPENDIX A ■ FACELETS TAG REFERENCE278

We’ll need a client for this template; see Listing A-5.

Listing A-5. insert-client.xhtml

<ui:composition template="insert-template.xhtml"><ui:define name="title">

The Parrot Quest</ui:define>

</ui:composition>

In this client Facelets application, we have only defined the "title", so the "content" willbe the default value. Given that, we expect the following output:

<h1>The Parrot Quest

</h1><div>

No content is defined</div>

The name attribute of the insert tag is optional. When it is not present, the whole clienttemplate will be inserted, so it is not necessary to use define tags in the client. Let's see thiswith the new example in Listings A-6 and A-7.

Listing A-6 contains the code for a template that contains a ui:insert tag without attri-butes or children.

Listing A-6. insert-template2.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD ➥

HTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/ ➥

xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets"><body>

<div><h1>One story of Birds</h1><ui:insert/>

</div></body></html>

In Listing A-7, we show how to use the previous template to include some content.

APPENDIX A ■ FACELETS TAG REFERENCE 279

Listing A-7. insert-client2.xhtml

<ui:composition template="insert-template2.xhtml">One day I decided to start countingthe number of parrots in the world,just to find that...<br/><h:inputTextarea value="#{backingBean.story}"/>

</ui:composition>

In this case, the whole content of the composition in insert-client2.xhtml will beinserted where the insert tag has been placed in the template. The output will be as follows:

<div><h1>One story of Birds</h1>One day I decided to start countingthe number of parrots in the world,just to find that...<br /><textarea name="_id3"></textarea>

</div>

<ui:param/>Until now, we have been looking at how Facelets can pass fragments of code between docu-ments. But we can also pass objects using the ui:param tag. This tag is used to pass objects asnamed variables between Facelets. Table A-9 shows its attributes.

Table A-9. UI Param Attributes

Attribute Name Required Description

name Yes The name of the variable to pass to the included Facelets instance

value Yes The literal or EL expression value to assign to the named variable

The name attribute of the ui:param tag must match the name of a ui:define tag con-tained in the template defined in the ui:composition or ui:decorate tag. Listing A-8 showsan example.

Listing A-8. param-details.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets">

APPENDIX A ■ FACELETS TAG REFERENCE280

<body><ui:composition>

<div><h3>#{birdName}</h3>Order: #{birdOrder}<br/>Family: #{birdFamily}

</div></ui:composition>

</body></html>

We use the previous Facelets file in the application in Listing A-9.

Listing A-9. param-example.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD ➥

XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/ ➥

xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets"><body>

<ui:include src="param-details.xhtml"><ui:param name="birdName" value="Parrot"/><ui:param name="birdOrder"

value="Psittaciformes"/><ui:param name="birdFamily"

value="Psittacidae"/></ui:include>

<ui:decorate template="param-details.xhtml"><ui:param name="birdName" value="Eagle"/><ui:param name="birdOrder"

value="Falconiformes"/><ui:param name="birdFamily"

value="Accipitridae"/></ui:decorate>

</body></html>

In this example, we are using ui:param to pass several literals (we could have referred toother objects using EL expressions) to the included document or to a template (in our exam-ple, both point to the same Facelets file: param.details.xhtml). The relevant portion of theresulting output follows:

APPENDIX A ■ FACELETS TAG REFERENCE 281

<div><h3>Parrot</h3>Order: Psittaciformes<br />Family: Psittacidae

</div><div>

<h3>Eagle</h3>Order: Falconiformes<br />Family: Accipitridae

</div>

<ui:remove/>The ui:remove tag is used to remove blocks of code at compilation time. It has no attributes,though you can use this tag in conjunction with the jsfc attribute.

This tag provides a way to remove parts of the document used during development ortesting when the application goes into production, allowing to retain the bits of code for uselater if further development or bug fixes are needed.

<ui:remove>This will be removed.

</ui:remove>This will survive<div jsfc="ui:remove">This will be removed too<h:outputText value="#{backingBean.andThisToo}"/></div>And this will survive too!

Most of the content of the previous snippet won’t appear in the final output:

This will surviveThis will survive too!

You may wonder why we are not using normal HTML comments (starting the com-mented section with the characters <!-- and ending it with --> ) to remove the contentfrom the final page, as what we put between the comment characters won’t be visible tothe user. Facelets will interpret the EL expressions within the comments unless the contextparameter facelets.SKIP_COMMENTS is set to true in the web.xml file. In that case, the behav-ior would be similar.

APPENDIX A ■ FACELETS TAG REFERENCE282

<ui:repeat/>The ui:repeat tag is used to iterate over a list of objects, and we always recommend its useinstead of c:forEach from the JSTL Code tag library. Table A-10 shows its attributes.

Table A-10. UI Repeat Attributes

Attribute Name Required Description

value Yes EL expression that resolves to the list of objects to be iterated over

var Yes The literal name of the variable used to iterate over the collection

As an example, take a look at Listing A-10, where we use the repeat tag to iterate over a listof birds provided by a backing bean.

Listing A-10. repeat-example.xhtml

…<ul>

<ui:repeat var="bird"value="#{birdDirectory.birds}">

<li>#{bird.name}</li></ui:repeat>

</ul>…

The relevant resulting output follows:

<ul><li>Parrot</li><li>Eagle</li>

</ul>

You can also use the ui:repeat tag with the jsfc attribute. The snippet in Listing A-11 willproduce the same output as in Listing A-10:

Listing A-11. repeat-jsfc-example.xhtml

…<ul>

<li jsfc="ui:repeat"var="bird"value="#{birdDirectory.birds}">

#{bird.name}</li>

</ul>…

APPENDIX A ■ FACELETS TAG REFERENCE 283

■Caution ui:repeat and c:forEach are different. ui:repeat is a render-time evaluation, whereasc:forEach is a build-time evaluation. c:forEach does not represent a component in Facelets (it is aTagHandler) and will never become part of the component tree. It is used to create the tree when thepage is first referenced (when the request is not a postback), but after that, c:forEach will not do anythingelse. On the other hand, ui:repeat is implemented as a component in Facelets and is part of the compo-nent tree. As an example, you could develop a list of elements with a button to add more elements. If youused forEach for the iteration, the new elements would never be added when the button is clicked (whichis a postback).

APPENDIX A ■ FACELETS TAG REFERENCE284

View State Encryption

View state encryption with version 1.2 of MyFaces requires no assembly. By default, MyFaceswill generate a random password at startup and use the Data Encryption Standard (DES)encryption algorithm. DES is usually sufficient, but stronger encryption algorithms can beconfigured using context parameters in the deployment descriptor. The following code snip-pet shows how to configure an application to use the Blowfish encryption algorithm with asecret of size 16:

<context-param><param-name>org.apache.myfaces.ALGORITHM</param-name><param-value>Blowfish</param-value>

</context-param><context-param>

<param-name>org.apache.myfaces.SECRET</param-name><param-value>NzY1NDMyMTA3NjU0MzIxMA</param-value>

</context-param>

Using stronger forms of view state encryption may result in the following exceptions:

• java.security.InvalidKeyException: Illegal key size or default parameters

• java.lang.SecurityException: Unsupported key size or algorithm parameters

These exceptions mean few JARs under <JAVA_HOME>jre\lib\security need to bereplaced with unlimited strength policy JAR files. The replacement JARs can be downloadedfrom http://java.sun.com/j2se/1.4.2/download.html. Consult international cryptographylaws if you plan on distributing your JSF application across international boundaries.

The org.apache.myfaces.SECRET context parameter is the second hurdle for stronger viewstate encryption. This parameter is the base-64–encoded form of the password, or secret. Base64 encoding is used in order to allow applications to use passwords composed of nonprintablecharacters. There is a command line utility class in MyFaces for encoding passwords of print-able characters. Using this command may require Jakarta commons-logging and Jakartacommons-codec to be in the classpath:

commandPropt$ java org.apache.myfaces.util.StateUtils abcd1234

285

A P P E N D I X B

Here is how to use the Triple DES encryption algorithm with a secret of size 24:

<context-param><param-name>org.apache.myfaces.ALGORITHM</param-name><param-value>DESede</param-value>

</context-param><context-param>

<param-name>org.apache.myfaces.SECRET</param-name><param-value>MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz</param-value>

</context-param>

The following example uses the Advanced Encryption Standard (AES) encryption inCipher Block Chaining (CBC) mode with a secret of size 24:

<context-param><param-name>org.apache.myfaces.ALGORITHM</param-name><param-value>AES</param-value>

</context-param><context-param>

<param-name>org.apache.myfaces.ALGORITHM.PARAMETERS

</param-name><param-value>CBC/PKCS5Padding</param-value>

</context-param><context-param>

<param-name>org.apache.myfaces.ALGORITHM.IV</param-name><param-value>NzY1NDMyMTA3NjU0MzIxMA==</param-value>

</context-param><context-param>

<param-name>org.apache.myfaces.SECRET</param-name><param-value>MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz</param-value>

</context-param>

The org.apache.myfaces.ALGORITHM.PARAMETERS context parameter can be used to con-figure encryption mode. We don’t recommend tinkering with this parameter unless you arecomfortable with the low-level specifics of encryption. The default encryption mode isElectronic Codebook (ECB). CBC mode is generally regarded as better than ECB (for reasonsbeyond the scope of this book) and requires what is known as an initialization vector (IV).The IV, like the secret, is base 64 encoded.

The JSF 1.1 specification does not require view state encryption, but MyFaces has pro-vided it since the 1.1.2 release. By default, the MyFaces JSF 1.1 implementation does notencrypt the view state in order to maintain backward compatibility with earlier versions ofMyFaces core; versions 1.1.2 and 1.1.3 of MyFaces recognize these security context parameternames in lowercase.

APPENDIX B ■ VIEW STATE ENCRYPTION286

Custom Dependency Injection

The most popular way to override JSF dependency injection is to use Spring. This is doneusing a custom EL VariableResolver that comes with the Spring framework. The followinglines of JSF configuration code instruct MyFaces to delegate all managed bean constructionto Spring:

<application><variable-resolver>

org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>

</application>

Spring has added value to the Java community, and it clearly has market penetration,but one limitation of Spring dependency injection is that it currently does not supportannotations. This means you are jumping from one XML file (faces-config.xml) to another(application-context.xml). If you feel a strongly typed approach to dependency injection ismore attractive, MyFaces 1.2.2 also integrates with Guice using a custom EL Resolver:

<application><el-resolver>

org.apache.myfaces.el.unified.resolver.GuiceResolver</el-resolver>

</application>

The GuiceResolver looks to application scope for the Guice Injector, which is typically placed in application scope via ServletContextListener. You can configureServletContextListener by placing the following code in your /WEB-INF/web.xml file:

<listener><listener-class>

org.apache.myfaces.book.GuiceContextListener</listener-class>

</listener>

287

A P P E N D I X C

In the ServletContextListener implementation, you then configure dependency injec-tion the way anyone in the Guice community would want it—in plain Java:

public class GuiceContextListener implements ServletContextListener {/* Occurs once, at startup */public void contextInitialized(ServletContextEvent event) {

ServletContext ctx = event.getServletContext();Injector injector = Guice.createInjector(new ShoppingModule());// place the Injector where the Resolver can find itctx.setAttribute(GuiceResolver.KEY, injector);

}

public void contextDestroyed(ServletContextEvent event) {ServletContext ctx = event.getServletContext();ctx.removeAttribute(GuiceResolver.KEY);

}

}public class ShoppingModule implements com.google.inject.Module{

public void configure(Binder binder) {

binder.bind(Order.class).to(BulkOrder.class);

}

}

MyFaces Guice integration will mean far less configuration code but has drawbacks aswell. Guice has nowhere near the market penetration of Spring. GuiceResolver can only beused in JSF 1.2 applications, because the el-resolver element was not available in JSF 1.1.The GuiceResolver class is also tied to the MyFaces implementation; it will not work withSun’s RI. Finally, GuiceResolver still requires you to “name” your managed bean the old-fashioned way—in a JSF configuration file, so you still have to declare your managed beanin JSF configuration file, specifying its name and scope just as you normally would. Itsdependencies, however, are configured via annotations.

APPENDIX C ■ CUSTOM DEPENDENCY INJECTION288

■Aabstraction

moving from Struts frameworks to JSF, 9AbstractTagLibrary class, 83accept attribute, EmailValidator class, 145access keys

labels, Tobago, 204, 209access lifetime

conversations, 174Access-scoped conversation, 174, 177accessibility-mode tag, trinidad-

config.xml, 162action attribute

button control, Tobago, 205command control, Tobago, 206dialog framework, Trinidad, 133menuItem tag, Tobago, 209navigationMenuItem tag, 41

action handlersmoving from Struts frameworks to JSF,

10action listener methods

interfaces and JSF development, 262action listeners

avoiding risk in JSF life cycle, 233pageFlowScope managing workflows,

115action methods

avoiding risk in JSF life cycle, 233querying ORM framework in, 230writing MyFaces JSF application, 16

action-oriented patternsmoving from Struts frameworks to JSF, 8

ActionEvent referenceavoiding risk in JSF life cycle, 233

actionFor attributeCommandButton/CommandLink

components, 25, 58actionListener attribute

Ajax and JSF development, 259DataScroller component, 33

activePanelTabVar attribute, TabbedPane,44

activeSubStyleClass attribute,TabbedPane, 44

activeTabStyleClass attribute,TabbedPane, 44

addPartialTarget method, RequestContextAjax and JSF development, 259programmatic access to PPR, 127

addPartialTriggerListeners method,RequestContext

adding PPR to custom components, 128addResources attribute, Calendar, 29address book example, Tobago, 199Address class, 131AddressDialog class, 135, 137addressDialog.jspx, 135addToSchedule method,

EventCreatorBean, 63AdminController class

security for Tobago applications, 225Advanced Encryption Standard (AES)

encryption, 286advice

aspect-oriented programming, 187@agent instruction

skinning, Trinidad, 160Ajax

domReplaceListener, 130JSF development, 251–260notifying users of progress, 123sequence diagram of use case, 121stateChangeListener, 130

Ajax requestsconversation lifetimes, 174making non-JSF Ajax requests, 129non-JSF Ajax request parameters, 129PPR JavaScript API, 129–130

Ajax supportadding PPR to custom components, 127reasons for using Trinidad, 113

Alert valueclient-side validation, Trinidad, 141

alias selectorsskinning, Trinidad, 161

Index

289

align attribute, inputText tagvendor lock-in, 251

annotations@ConversationRequire, 184@DataProvider, 192@InitView, 182limitation of Spring dependency

injection, 287@ManyToOne, 192mapping via, 182@PreProcess, 182@PreRenderView, 182@Transactional, 188using persistence with, 187–188using persistence without, 188@ViewController, 182

antipatternsMap Trick antipattern, 233–234N Plus One antipattern, 229–233Validating Setter antipattern, 267–269

Apache MyFaces, 10–19compatibility and compliance, 11configuring, 12–13defining core components, 13defining HTML components, 13delegating managed bean construction

to Spring, 287evolution of Java web frameworks, 4extension components, 11Facelets dependencies, 70Guice integration, 287, 288important MyFaces JARs, 12installing, 11MyFaces application ingredients, 13SECRET context parameter, 285Tomahawk library, 81

creating scrollableDataTablecomponent, 92

Trinidad library, 81using in JSP pages, 13view state encryption, 285–286writing JSF application, 13–19

Apache Trinidad see TrinidadAPIs

Java Persistence API, 185–186Orchestra API, 196–198

Application scopedetermining scope, 242managed bean scopes available in JSF,

171thread safety, 239

applicationContext.xml fileconfiguring conversation-scoped

managed beans, 177configuring Spring framework,

Orchestra, 168, 169declaring converter in, 191using Orchestra persistence support,

186apply method, TagHandler, 102apply request values phase, JSF life cycle,

7aqua skin

declaration in trinidad-skins.xml, 158,159

architectural issues see design issuesattribute tag

button control, Tobago, 211attributes

jsfc attribute, 85attributes, Tomahawk

Calendar component, 29DataList component, 38DataScroller component, 30, 33displayValueOnly attribute, 23forceId attribute, 23JSCookMenu component, 42NewspaperTable component, 40Schedule component, 56–57TabbedPane component, 44Tree2 component, 52ValidateRegExpr component, 46

authentication, Tobagoenabling form-based authentication,

225autoSubmit attribute, Trinidad, 123–125

■BbackgroundClass attribute, Schedule, 57Basic attribute, DynaForm, 192basic controls, Tobago, 203–206BasicExamples.war file

running MyFaces JSF application, 19beans

see also managed beansaccessing beans located in

pageFlowScope, 121declaration attributes, 179managing bean declarations, 177mapping views to beans, 182

beanutilscommons-beanutils.jar, 12

■INDEX290

beanutils dependency, Tobago, 200behavior

Facelets and tags with, 240–241BillingInfo class, 133, 137billingInfo.jspx, 133bind method, PersistenceContext

using non-JPA persistenceimplementations, 189

bindArgs variableAjax and JSF development, 254

binding attributecomponent tag, Facelets, 271fragment tag, Facelets, 277

bird-functions.taglib.xml, 83BirdFunctions class, 84blank example, Tobago, 199Blowfish encryption algorithm, 285bookmarking

problems with managed bean scopes,JSF, 115

box container, Tobagopartial rendering, 227

box-template.xhtml, 274broadcast method

support for firing partial updatenotifications, 128

browser windowsmanaging independent windows, 175sessions and, 176

BUFFER_SIZE parameter, Facelets, 71bundle-name skin tag, Trinidad, 158busy facet

statusIndicator component, Trinidad,123

button control, Tobago, 205popup facet, 211

■CCACHE_VIEW_ROOT parameter, Trinidad,

163Calendar component, Tomahawk, 24,

25–29attributes, 29creating inline calendar, 27creating pop-up calendar, 27–28Event Creator application, 59popupDateFormat attribute, 27, 29renderAsPopup attribute, 27, 29renderPopupButtonAsImage attribute,

27, 29

CalendarBean class, 25callback parameter

non-JSF Ajax requests, 129cell tag, Tobago, 213cellText expression, EL, 90c:forEach see forEach tagchange event, Tobago select controls, 206Charlotteville theme, Tobago, 215Chart component, Trinidad, 150–153

chart customization, 152chart generated using, 152ChartModel class, 150defining chart model, 151drill-down listener, 152handling chart events, 152

ChartModel class, 150methods, 151

checkbox controls, TobagomenuCheckbox control, 209selectBooleanCheckbox control, 206selectManyCheckbox control, 206

CHECK_FILE_MODIFICATIONparameter, Trinidad, 163

Cipher Block Chaining (CBC) modeAdvanced Encryption Standard (AES),

286class attribute

overriding createMetaRuleset method,104

classesAbstractTagLibrary, 83BirdFunctions, 84CalendarBean, 25ComponentHandler, 104ConvertHandler, 106ConvertNumberHandler, 106DataListBean, 34DataScrollerBean, 30DefaultResourceResolver, 109EventCreatorBean, 59Facelet, 100FaceletContext, 81FaceletFactory, 99FaceletHandler, 100FaceletViewHandler, 72, 99HtmlComponentHandler, 104HttpServlet, 3InputSuggestAjaxComponentHandler,

105MetaData, 103MetaDataHandler, 103

■INDEX 291

MetaDataTarget, 103MetaRule, 103MetaRuleset, 103MetaTagHandler, 103NewspaperTableBean, 39Person managed bean, 45RandomGeneratorTagHandler, 101ResponseWriter, 71ScheduleBean, 53TagDecorator, 71TagHandler, 102TagLibrary, 83Tree2Bean, 47Tree2LazyLoadingBean, 51UIViewRoot, 99ValidateDelegateHandler, 107ValidateHandler, 107ViewHandler, 99, 110

classes folder, WEB-INFTomahawk components, 25

click event, Tobago select controls, 206client-side conversion/validation,

Trinidad, 140–150e-mail example, 141–148exception and message APIs, 148–150

client-side exception parameters, 149Tr prefix, 148

client-side messages, 149–150client-validation tag, Trinidad, 140, 162ClientConverter interface, Trinidad, 141ClientSideToggle attribute, Tree2, 51, 52ClientValidator class, Trinidad, 145CLIENT_STATE_MAX_TOKENS

parameter, Trinidad, 163CLIENT_STATE_METHOD parameter,

Trinidad, 163close method, PersistenceContext, 189codec

commons-codec.jar, 12CollectionModel class, Trinidad, 153collections

commons-collections.jar, 12collections dependency, Tobago, 200column element

Table component, Trinidad, 153, 154column tags

sheet control, Tobago, 207using <tc:out> tag, 208

columnBandingInterval attributeTable component, Trinidad, 157

columnClass attribute, Schedule, 57

columnscreating editableColumn component,

96–98creating simpleColumn component,

89–91NewspaperTable component,

Tomahawk, 38columns attribute

gridLayout tag, Tobago, 212Command component

shipping address dialog example, 132command control, Tobago, 206commandButton tag, 15CommandButton/CommandLink

componentsactionFor attribute, 25, 58

commandLink tag, TrinidadAjax and JSF development, 258, 259creating directory of related pages, 76

commands, Tobago, 205comments

HTML comments, 282SKIP_COMMENTS parameter, Facelets,

72common logging APIs

Orchestra dependencies, 167commons-beanutils dependency, Tobago,

200commons-beanutils.jar, 12commons-codec.jar, 12commons-collections dependency,

Tobago, 200commons-collections.jar, 12commons-digester dependency, Tobago,

200commons-digester.jar, 12commons-discovery.jar, 12commons-el.jar, 12commons-fileupload dependency,

Tobago, 200commons-io dependency, Tobago, 200commons-lang dependency, Tobago, 200commons-logging dependency,

Orchestra, 167commons-logging dependency, Tobago,

200commons-logging.jar, 12compactMonthRowHeight attribute,

Schedule, 56compactWeekRowHeight attribute,

Schedule, 56

■INDEX292

component libraries, JSF, 6component objects see componentscomponent parameter

launchDialog method, RequestContext,139

component tag, Facelets UI, 271creating InputTextLabeled component,

87creating ScrollableDataTable

component, 93creating simpleColumn component, 90templates, Facelets, 85

component treeFacelet class, 100inserting UIComponent instance into,

277ui:repeat tag, 284UIViewRoot class, 100

component-oriented architectureevolution of Java web frameworks, 5moving from Struts frameworks to JSF, 8

ComponentHandler class, 104components

creating custom components, JSF, 10DynaForm component, 191–194JSF features, 5moving from Struts frameworks to JSF,

10components folder

Tomahawk components, 25components, Facelets see Facelets

componentscomponents, Tobago see Tobago

componentscomponents, Tomahawk see Tomahawk

componentscomponents, Trinidad see Trinidad

componentscomposition tag, Facelets UI, 272

creating directory of related pages, 75,76

creating simpleColumn component, 90templates, 85

Concurrent Versions System (CVS), 69configuration files

MyFaces applications, 13specifying JSF configuration files, 235

configuration, Trinidad, 140–141, 161–163trinidad-config.xml file, 161, 162

CONFIG_FILES context parameterspecifying JSF configuration files, 235

confirmation facet, button control,Tobago, 206

ConnectionManagerDataSource classpersistence, Orchestra, 189

content classesRequestContext class, Trinidad, 114

content parameternon-JSF Ajax requests, 129

contentClass attribute, Schedule, 57context parameter

non-JSF Ajax requests, 129contextConfigLocation parameter,

web.xml fileconfiguring Spring framework,

Orchestra, 168controls, Tobago see Tobago controlsconversation beans

configuring conversation-scopedbeans, 177–179

conversationName attribute, 179lifetime property,

SpringConversationScope, 178managed conversation bean, 178scope attribute, 179SpringConversationScope properties,

178timeout property,

SpringConversationScope, 178Conversation class, Orchestra, 196–197

getAttribute method, 197getCurrentInstance method, 197invalidate method, 197setAttribute method, 197

conversation contextsgrouping conversations into, 180Orchestra, 165separating conversation context, 180tracking, 194

Conversation scopeconfiguring conversation-scoped

beans, 177–179declaring conversation-scoped beans,

172master-detail user interface design, 245Orchestra, 165, 172, 173using conversation-scoped persistence,

173ConversationAware interface, Orchestra,

198ConversationContext class, Orchestra,

194–195

■INDEX 293

ConversationManager class, Orchestra,194, 197

getConversation method, 197ConversationMessager interface,

Orchestra, 198conversationName attribute, 179@ConversationRequire annotation

associating views with beans, 182requiring conversations,

ViewController, 184conversations

see also workflowsaccess lifetime, 174Access-scoped conversation, 174ending using JSF component, 179grouping into conversation context, 180lifetime of, 174–175managing independent windows, 175manual lifetime, 174–175manual-scoped conversation, 174

invalidating in backing bean, 175invalidating using JSF components,

175objects stored in, 173Orchestra, 171–181

examples demonstrating, 172–173Spring Framework, 166

projects addressing conversation issue,172

qualifying as, 173requiring, ViewController, 184Session scope, 171

conversation-related JSF tags, 179–181endConversation tag, 179

errorOutcome attribute, 180name attribute, 180onOutcome attribute, 180

saveState tag, 172separateConversationContext tag, 180

ConversationUtils class, Orchestra, 197conversion scope, JSF, 10conversion, Trinidad, 114

client-side conversion and validation,140–150

e-mail conversion and validationexample, 141–148

faces-config.xml file, 148convertDateTime tag, 27converter attribute, 239

convertersavoiding risk in JSF life cycle, 233JSF features, 5thread safety, 239view state encryption, 265

ConvertHandler class, 106ConvertNumberHandler class, 106core components, MyFaces, 13Core library, 81CorePanelGroupLayout

Ajax and JSF development, 259course managed bean, 30, 34, 43create method,

persistenceContextFactory, 189createMetaRuleset method

HtmlComponentHandler class, 104MetaDataHandler class, 103MetaTagHandler class, 107

CSS compressionskinning, Trinidad, 160

css folder, Tomahawk components, 25CSS selectors

alias selectors, skinning, 161customizing components using, 159

CSS source, trinidad-skins.xml, 158CSS style, 217currency-code tag, trinidad-config.xml,

162currentDayCellClass attribute, Calendar,

29custom components, JSF, 10custom namespace

creating components, Facelets, 86customer registration

pageFlowScope example, 115–120CVS (Concurrent Versions System)

downloading Facelets, 69

■DData Access Objects (DAO)

Ajax and JSF development, 254using persistence with annotations, 187

database accessOrchestra working at web tier, 166

databases, using in JSFconsidering action methods, 233

DataList component, Tomahawk, 34–38attributes, 38creating grid DataList, 37creating ordered DataList, 36–37

■INDEX294

creating unordered DataList, 35–36description, 24layout attribute, 34, 36, 38rendering styles, 34value attribute, 34, 35, 38

dataList tag, 34DataListBean class, 34DataModel class

master-detail user interface design, 243,245

Table component, Trinidad, 153, 155@DataProvider annotation

DynaForm component, 192DataScroller component, Tomahawk, 24,

29–33attributes, 30, 33creating scrollableDataTable

component, 91, 94dataScroller tag, 30DataScrollerBean class, 30datasets

N Plus One antipattern, 229dataTable component

creating scrollableDataTable, 91, 92, 94,95

dataTable tag, 243, 245dateClass attribute, Schedule, 57dates

Calendar component, Tomahawk, 25convertDateTime tag, 27Event Creator application, 58JSF DateTime, 27

dayCellClass attribute, Calendar, 29dayClass attribute, Schedule, 57debug tag, 273debug-output tag, trinidad-config.xml,

162, 163DEBUG_JAVASCRIPT parameter, Trinidad,

163DEBUG_MODE parameter

ui:debug tag, Facelets, 273decimal-separator tag, trinidad-

config.xml, 162decorate tag, Facelets UI, 85, 273–275

template attribute, 273DECORATORS parameter, Facelets, 71defaultCommand attribute

button control, Tobago, 206DefaultResourceResolver class, 109

DEFAULT_SUFFIX parameter, javax.faces,71

configuring Apache MyFaces, 13define tag, Facelets UI, 276

creating directory of related pages, 75,78

define-template.xhtml, 276Déjà Vu PhaseListener, 234–235DELETE request

Ajax and JSF development, 254deleted markup, Tobago, 217deleteEmployee event handler, 252, 254deleteEmployeeCallback event handler,

253demo folder

downloading Facelets, 69demonstration example, Tobago, 199@DenyAll annotation, Tobago, 226dependencies

Facelets, 70Orchestra, 166–167Tobago, 200

dependency injectionlimitation of Spring dependency

injection, 287masterDetail managed bean, 243moving from Struts frameworks to JSF,

10overriding JSF dependency injection,

287recursive dependency injection, 238strongly typed approach to, 287Validating Setter antipattern, 267

DES (Data Encryption Standard)encryption algorithm, 286Triple DES encryption algorithm, 286

description attribute, ScheduleModel, 55description element, managed-bean, 17description parameter, TreeNodeBase, 50design issues

Ajax and JSF, 251–260Déjà Vu PhaseListener, 234–235Facelets, 99–100Facelets and tags with behavior,

240–241JSF interfaces, 260Law of Demeter, 241–242Map Trick antipattern, 233–234master-detail user interface design,

242–250N Plus One antipattern, 229–233

■INDEX 295

Orchestra, 194–198portlet issues, 266–267static typing, 236–239thread safety, 239–240Validating Setter antipattern, 267–269vendor lock-in, 250–251view state encryption, 262–266XML Hell, 235–236

design patterns see patternsdetached entity

managing persistence in Orchestra, 186detail parameter, TrFacesMessage, 149detail toggling

Table component, Trinidad, 157detailStamp facet

Table component, Trinidad, 157DEVELOPMENT parameter, Facelets, 72dialog, 130dialog framework, Trinidad, 114, 130–140

inputListOfValues component, 138launchListener method, 138obtaining dialog parameters, 138passing data to dialog, 137–138programmatic dialog management,

139–140shipping address dialog example,

131–137simplified dialogs, 138specifying launchListener, 137useWindow attribute, 130

dialog navigations, Trinidad, 132dialogParameters parameter

launchDialog method, RequestContext,139

dialogs, Tobagodisplaying modal dialog, 211displaying pop-up confirmation dialog,

211digester

commons-digester.jar, 12digester dependency, Tobago, 200disabled attribute

input control, Tobago, 204Disabled value

client-side validation, Trinidad, 141disabledTabStyleClass attribute,

TabbedPane, 44DISABLE_CONTENT_COMPRESSION

parameter, Trinidad, 163discovery

commons-discovery.jar, 12

displayedRowsCountVar attribute,DataScroller, 33

displayValueOnly attribute, Tomahawk, 23div tag, 65

creating directory of related pages, 74document type definition (DTD), 82doGet function

servlet program structure, 3Dojo

Ajax and JSF development, 252, 254DOM Inspector

view state encryption, 263domReplaceListener, Ajax, 130doPost function

servlet program structure, 3drill-down listener

handling chart events, 152dropdown list controls, Tobago

selectOneChoice control, 206DTD (document type definition)

describing library files, 82DynaForm component, 191–194

JSF view using with data table, 192using JSF views, 192

■Eeager relationships

managing persistence in Orchestra, 185eagle.xhtml page

creating directory of related pages,78–79

editableColumn component, Faceletscreating, 96–98creating tag source file, 96registering tag in tag library, 97

editMode attributecreating editableColumn component,

96EL (Expression Language)

commons-el.jar, 12JSF EL, 80JSP EL, 80resolving objects to be iterated over, 283tag library functions, 84Unified EL, 80variable scope, 81

EL API, Facelets dependencies, 70EL libraries, 71EL RI, Facelets dependencies, 70

■INDEX296

Email classe-mail conversion/validation

Email.java, server-side, 142Email.js, client-side, 142

EmailConverter classe-mail conversion/validation

EmailConverter.java, server-side, 143EmailConverter.js, client-side, 144

EmailValidator classe-mail conversion/validation

EmailValidator.java, server-side, 145EmailValidator.js, server-side, 147

ENABLE_LIGHTWEIGHT_DIALOGSparameter, Trinidad, 163

encapsulationLaw of Demeter, 241–242

encodeEnd methodrendering components, Tobago, 221

encodingbase 64 encoding, 285commons-codec.jar, 12

encryptionAdvanced Encryption Standard (AES)

encryption, 286Blowfish encryption algorithm, 285Data Encryption Standard (DES), 285disabling for development, 263Triple DES encryption algorithm, 286view state encryption, 262–266view state encryption, MyFaces,

285–286endConversation tag, Orchestra, 179endTime attribute, ScheduleModel, 55enterInformation.jsp

writing MyFaces JSF application, 14@Entity, JPA

DynaForm component, 191entity, persistence context, 185

detached entity, 186entityManager

throwing away, 188using Orchestra persistence support,

187using persistence with/without

annotations, 188entryClass attribute, Schedule, 57entryRenderer attribute, Schedule, 57error pages

programmatic dialog management, 139error.jspx

programmatic dialog management, 140

errorOutcome attribute, endConversationtag, 180

evenClass attribute, Schedule, 57Event Creator application

Tomahawk, 58–65event facets, Tobago select controls, 206EventCreator managed bean class, 59EventCreatorBean class

addToSchedule method, 63updateScheduleView method, 63

eventsJSF features, 5managing with ViewController, 165,

181–184exception API

client-side conversion/validation,148–150

exceptionsclient-side exception parameters, 149InvalidKeyException, 285programmatic dialog management, 139SecurityException, 285

expandToFitEntries attribute, Schedule,56

Expression Language see ELextends skin tag, Trinidad, 158, 161extension library

referencing, Tobago, 204

■FFacelet class, 100FaceletContext class, 81FaceletFactory class, 99FaceletHandler class, 100Facelets

architecture, 99–100creating application with, 68–79creating composite views, 272creating JSF views, 72–79creating project structure, 70–71creating tag libraries, 81–83custom resource resolvers, 108–110custom tag development, 100–103dependencies, 70describing library files, 82downloading, 69enabling Facelets in applications, 71extending Facelets, 99–110FaceletViewHandler class, 99faces-config.xml file, 72

■INDEX 297

including Facelets file in document, 277initialization parameters, web.xml file

BUFFER_SIZE, 71DECORATORS, 71DEVELOPMENT, 72LIBRARIES, 72REFRESH_PERIOD, 72RESOURCE_RESOLVER, 72SKIP_COMMENTS, 72

inline text, 80iterating over list of objects, 283JSF editor tools, 75JSF libraries, 81jsfc attribute, 68, 85JSP and JSF differences, 67–68JSTL libraries, 81metatags, 103–110migrating existing application from JSP

to, 79mixing HTML with JSF tags, 10modifying behavior when resolving

URL resources, 108passing objects between documents,

280reasons for using, 68removing blocks of code at compile, 282reusing custom tag library, 98–99tag libraries, 81–84tag library functions, 83tag reference, 271–284tags with behavior, 240–241templates, 68, 85templating library, 81Tobago supporting view definitions, 203tree generation in JSP compared, 100Unified EL, 68, 80using JSF without dependency on JSP

taglib, 9using JSTL with JSF, 68vendor lock-in, 251ViewHandler class, 99, 110web containers, 68web.xml file, 71–72

Facelets componentscreating composition components, 68,

86–99creating custom components, JSF, 10custom component handlers, 104–106custom conversion handlers, 106–107custom validation handlers, 107–108editableColumn component, 96–98

inputTextLabeled component, 86–89scrollableDataTable component, 91–95simpleColumn component, 89–91TagHandler component, 100–103

facelets folder, WEB-INFcreating scrollableDataTable

component, 92reusing custom tag library, 98

Facelets UI tagscomponent tag, 271composition tag, 272creating directory of related pages, 73debug tag, 273decorate tag, 273–275define tag, 276fragment tag, 277include tag, 277–278insert tag, 278–280param tag, 280–281remove tag, 282repeat tag, 283–284

FaceletViewHandler classDEVELOPMENT parameter, 72Facelets, 99LIBRARIES parameter, 72replacing JSF ViewHandler, 72

faces descriptor see faces-config.xml filefaces-config.xml file

configuring Tobago, 202creating directory of related pages, 73,

76defining MyFaces core components, 13e-mail conversion and validation

example, 148pageFlowScope managing workflows,

119replacing JSF ViewHandler, 72security for Tobago applications, 225setting up Trinidad, 111shipping address dialog example, 136Trinidad render kit in, 113writing MyFaces JSF application, 17

FacesContext class, 239FacesInterceptors class, 6FacesMessage class, 145, 148facesMessage parameter, 149FacesServlet controller

configuring Apache MyFaces, 13facets, 157fallback locales

resource management, Tobago, 216

■INDEX298

fallback themes, Tobago, 217family skin tag, Trinidad, 158fastforward facet, DataScroller, 31fastrewind facet, DataScroller, 31fastStep attribute, DataScroller, 30, 33field validators

writing MyFaces JSF application, 15file handles, using in JSF

considering action methods, 233file select control, Tobago, 211file tag, Tobago, 211fileupload dependency, Tobago, 200filters

TobagoMultipartFormdataFilter, 212Trinidad filter in web.xml file, 112

first attribute, DataList, 38first facet, DataScroller, 31firstRowIndexVar attribute, DataScroller,

33fixed layout token

layout manager, Tobago, 212fixedWidth/fixedHeight keys

LayoutableRendererBase class, 220flushing, persistence context, 185focus attribute

input control, Tobago, 204for attribute, DataScroller, 30, 33forceId attribute, Tomahawk, 23forEach tag, 80, 284

iterating over list of objects, Facelets,283

ui:repeat tag compared, 284foregroundClass attribute, Schedule, 57form control/tag, Tobago, 226format method,

TrFastMessageFormatUtils, 149messageString parameter, 150parameters parameter, 150

formatting-locale tag, trinidad-config.xml,163

formsSubForm component, Tomahawk, 57

fragment tag, Facelets UI, 277binding attribute, 277id attribute, 277templates, Facelets, 85

FrameworkAdapter interface, Orchestra,195

frameworks, JSF, 6freeClass attribute, Schedule, 57

from-outcome element, navigation-case,18

from-view-id element, navigation-rule, 18Function library, 81functions

tag library functions, 83

■GGET request

Ajax and JSF development, 254, 257getAsObject method, 140

EmailConverter class, 144, 145getAsString method, 140

EmailConverter class, 144getAttribute method

Conversation class, Orchestra, 197TagHandler class, 102

getChildren method, TreeNodeBase, 51getClientConversion method,

EmailConverter, 144getClientImportNames method,

EmailConverter, 144getClientLibrarySource method,

EmailConverter, 144getClientScript method, EmailConverter,

144getClientValidation method,

EmailValidator, 147getConversation method

ConversationManager class, Orchestra,197

getCurrentInstance methodConversation class, Orchestra, 197FacesContext class, 239RequestContext class, Trinidad, 114

getGroupLabels method, ChartModel, 151getRequiredAttribute method,

TagHandler, 102getResponseXyz methods,

TrXMLRequestEvent, 130getReturnValue method, Trinidad, 134getRowData method, DataModel, 244getSeriesLabels method, ChartModel, 151getStatus method, TrXMLRequestEvent,

130getValue method, 261getYValues method, ChartModel, 151grid DataList, creating, 37grid layout manager, Tobago, 212grid rendering style, DataList, 34, 38

■INDEX 299

gridLayout tag, Tobago, 212Guice integration, MyFaces, 287, 288GuiceResolver class, 288gutterClass attribute, Schedule, 57

■Hhandler-class element, 102, 103handlers

ConvertHandler class, 106handlers, Facelets

custom component handlers, 104–106custom conversion handlers, 106–107custom validation handlers, 107–108

hangman demonstrationdownloading Facelets, 69

Happy Birds Directory examplecreating JSF views, 72–79

header facetTable component, Trinidad, 154

headerClass attribute, Schedule, 57headerDateFormat attribute, Schedule, 56headerHeight key

LayoutableRendererBase class, 220headers parameter

non-JSF Ajax requests, 129headerText attribute, column element

specifying column header using, 154Table component, Trinidad, 153, 154

headerText expression, ELcreating simpleColumn component, 90

holidayClass attribute, Schedule, 57home page

creating directory of related pages,74–75

horizontalGridVisible attributeTable component, Trinidad, 157

host property, Email class, 142hotkey attribute

debug tag, Facelets UI, 273hoursClass attribute, Schedule, 57HTML tags

defining MyFaces HTML components,13

mixing HTML with JSF tags, 10writing MyFaces JSF application, 15

HtmlComponentHandler class, 104HttpServlet class, 3HttpServletRequest parameter, 3HttpServletResponse parameter, 3

■Iicon attribute

navigationMenuItem tag, 41id attribute

component tag, Facelets UI, 271fragment tag, Facelets UI, 277ScheduleModel, 55

id parameter, view/managed beansmaster-detail user interface design, 247,

248id skin tag, Trinidad, 158ignoreAll method, MetaRuleset class, 108image attribute

button control, Tobago, 205images folder, Tomahawk, 25ImplementationDependentManagedBean

interfaces and JSF development, 260in tag, Tobago, 204inactiveDayClass attribute, Schedule, 57inactiveSubStyleClass attribute,

TabbedPane, 44inactiveTabStyleClass attribute,

TabbedPane, 44include tag, Facelets UI, 277–278

creating directory of related pages, 75src attribute, 277

index.xhtml page, 74–75information entry screen, MyFaces, 14information viewing screen, MyFaces, 18init-param, servlets, 227@InitView annotation

mapping via annotations,ViewController, 182

initView method, ViewControllerinterface, 181

inline calendar, creating, 27inline client-side validation, Trinidad, 140inline text

Facelets using Unified EL, 80Inline value

client-side validation, Trinidad, 141input control, Tobago, 204–205

enabling without reloading, 227partial rendering, 227spacing controls, 212

input fieldswriting MyFaces JSF application, 15

inputCalendar tag, 26, 65inputDate component, 159inputHTML tag, displayValueOnly

attribute, 24

■INDEX300

inputListOfValues componentdialog framework, Trinidad, 138

InputNumberSliderTagDeclarationinterface

creating Tobago control, 223InputSuggestAjax component

DynaForm component using, 192inputSuggestAjax component, Tomahawk,

105InputSuggestAjaxComponentHandler

class, 105inputText component, 80

converting XML tags at compile time,85

creating inputTextLabeled component,86, 87

inputText tag, 15, 65inputTextarea tag, 15, 65inputTextLabeled component, Facelets

creating, 86–89creating tag source file, 86–87registering tag in tag library, 87–88

insert tag, Facelets UI, 278–280creating directory of related pages, 73,

74, 78creating scrollableDataTable

component, 94templates, 85insert-template.xhtml, 278insert-template2.xhtml, 279name attribute, 278, 279

interfacesJSF design issues, 260master-detail user interface design,

242–250interoperability

portlet issues, 266invalidate method

Conversation class, Orchestra, 197invalidateAndRestartCurrent method

ConversationUtils class, Orchestra, 197InvalidKeyException, 285invoke application phase, JSF life cycle, 8,

233io dependency, Tobago, 200isLeaf parameter, TreeNodeBase, 50isPartialRequest method, RequestContext,

127itemLabel attribute

navigationMenuItem tag, 41

itemStyleClass attribute, DataList, 38iteration

iterating over lists of objects, 283Iteration class

validating Setter antipattern, 268, 269

■JJARs

downloading Facelets, 69important MyFaces JARs, 12reusing custom tag library, 98

Java beansMyFaces applications, 13

Java codeencapsulating, 3moving from Struts frameworks to JSF,

10separating from markup, 3

Java Development Kit (JDK), 11Java Persistence API, 185–186

Orchestra dependencies, 166, 167Java Pet Store application see Pet Store

applicationJava web applications, 1Java web development

timeline of enhancements, 1unified standard for, 4

Java web frameworks, 1–5JavaServer Pages (JSP), 3Model, View, Controller (MVC) pattern,

4Servlet specification, 2–3Struts Application Framework, 4unified standard for Java web

development, 4JavaScript

executing PPR request from, 128Partial Page Rendering (PPR), Trinidad,

122sequence diagram of use case using

Ajax, 121JavaScript API

PPR, Trinidad, 128–130JavaServer Faces see JSFJavaServer Faces API, 70JavaServer Faces RI, 70JavaServer Pages see JSPJDK (Java Development Kit), 11JPA entity, DynaForm component, 191JPA template, Spring, 188, 189

■INDEX 301

JpaDaoSupport class, Spring, 188JSCookMenu component, Tomahawk, 24,

40–42attributes, 42

jscookMenu tag, 41JSF (JavaServer Faces)

advanced components, 10Apache MyFaces, 10–19client-side conversion and validation,

140component-oriented architecture, 9conversion scope, 10creating custom components, 10expressing logic in POJOs, 262extended JSF capabilities, Trinidad,

113–150features, 5–6history of, 4–5JSP differences, 67–68managed bean scopes available in, 171mixing HTML with JSF tags, 10moving from Struts frameworks to, 8–10non-JSF Ajax request parameters, 129problems with managed bean scopes

in, 115rendering output, 99shortcomings, 10state machine, 9templating support, 10use of XML in, 236using JSF without dependency on JSP

taglib, 9writing MyFaces application, 13–19writing output to response, 67

JSF 1.0, 4JSF 1.1, 4JSF 1.2, 5JSF applications

N Plus One antipattern, 229JSF components

displayValueOnly attribute, 23DynaForm component, 191–194ending conversation using, 179forceId attribute, 23invalidating manual conversation

using, 175multiple concurrent windows, 172Tomahawk tag library, 21, 22

JSF configuration files, 235

JSF convertersassociating views with beans, 182declaring converter in

applicationContext.xml, 191persistence, Orchestra, 190–191

JSF DateTime, 27JSF development, 229–269

Ajax and JSF, 251–260Déjà Vu PhaseListener, 234–235Facelets and tags with behavior,

240–241interfaces, 260Law of Demeter, 241–242Map Trick antipattern, 233–234master-detail user interface design,

242–250N Plus One, 229–233portlet issues, 266–267static typing, 236–239thread safety, 239–240Validating Setter antipattern, 267–269vendor lock-in, 250–251view state encryption, 262–266XML Hell, 235–236

JSF editor toolsworking with Facelets, 75

JSF EL, 80parameterized method invocation, 233

JSF frameworksMyFaces Trinidad, 111–164

JSF libraries, 81JSF life cycle, 6–8

apply request values phase, 7client-side conversion and validation,

140configuring Apache MyFaces, 13invoke application phase, 8, 233PPR requests, 129process validations phase, 7render response phase, 8restore view phase, 7update model values phase, 8validation phase, 141when to avoid risk, 233

JSF managed beansobjects stored in conversation, 173

JSF navigations, 132JSF pages

moving from Struts frameworks to JSF,10

■INDEX302

JSF tagsconversation-related, Orchestra,

179–181writing MyFaces JSF application, 15

JSF treeinserting new instance into, 271

JSF viewscreating, 72–79using DynaForm, 192

jsf-api.jar, 12, 71jsf-facelets.jar, 69jsf-impl.jar, 12jsf-ri.jar, 71jsfc attribute, Facelets, 85

reasons for using Facelets, 68remove tag, 282repeat tag, 283

JSP (JavaServer Pages)evolution of Java web frameworks, 3JSF differences, 67–68migrating existing application to

Facelets, 79separating Java code from markup, 3tree generation in Facelets compared,

100using JSF without dependency on JSP

taglib, 9writing output to response, 67

JSP documentssetting up Trinidad, 111

JSP EL, 80JSP files

MyFaces applications, 13JSP pages

setting up Trinidad, 111using Apache MyFaces in, 13

JSP Standard Template Library see JSTLJSP tags

defining to create Tobago controls,223–224

Facelets and tags with behavior, 240JSTL (JSP Standard Template Library)

EL variable scope, 81libraries, 81using with JSF, 68

jstl.jar, 12j_username/j_password login dialog input

fieldsenabling form-based authentication,

Tobago, 225

■Llabel attribute

button control, Tobago, 205input control, Tobago, 204inputTextLabeled component, Facelets,

87sheet control, Tobago, 207

labelscreating inputTextLabeled component,

86–89labels, Tobago

boilerplate code for rendering labels,204

labelWidth attributeinput control, Tobago, 204

lang dependency, Tobago, 200last facet, DataScroller component, 31lastRowIndexVar attribute, DataScroller,

33launchDialog method, RequestContext,

139launchListener method

dialog framework, Trinidad, 138specifying, dialog framework, 137

Law of Demeter, 241–242layout attribute

DataList component, 34, 36, 38JSCookMenu component, 42

layout management, Tobago, 212–214sizing rendered component, 220

LayoutableRendererBase class, 220LayoutInformationProvider interface, 220lazy loading

master-detail user interface design, 245Tree2 component, Tomahawk, 51

lazy relationshipsmanaging persistence in Orchestra, 185

LazyInitializationExceptionmanaging persistence in Orchestra, 185,

186li tag

DataList rendering, 34lib folder

creating directory of related pages, 73downloading and installing Orchestra,

166downloading Facelets, 69setting up Tomahawk, 21

■INDEX 303

librariesCore library, 81creating tag libraries, 81–83describing library files, 82Function library, 81JSF libraries, 81JSTL, 81referencing extension library, Tobago,

204tag libraries, 81–84templating library, 81Tomahawk, 81Trinidad, 81, 113

LIBRARIES parameter, Facelets, 72creating inputTextLabeled component,

88creating simpleColumn component, 90registering tag library, 83

library-class elementcreating tag library, 83

life cyclefinding life cycle methods,

ViewController, 182JSF (JavaServer Faces), 6–8

lifetime propertySpringConversationScope, 178

lifetime, conversations, 174–175link control, Tobago, 205listeners

configuring web.xml file, Orchestra, 167Déjà Vu PhaseListener, 234–235domReplaceListener, Ajax, 130drill-down listener, 152launchListener, dialog framework, 137ServletContextListener, 288setActionListener, 115SortListener, Trinidad Table

component, 155stateChangeListener, Ajax, 130

listsDataList component, Tomahawk, 34

locales, Tobago, 216logging

commons-logging.jar, 12logging dependency, Tobago, 200logic-markup interlacing issue, 3

■Mmanaged bean constructor

avoiding risk in JSF life cycle, 233

managed bean declarationswriting MyFaces JSF application, 17

managed bean scopesConversation scope, 172determining scope, 242problems in core JSF, 115scopes available in JSF, 171

managed beanssee also beansCalendarBean, 25configuring conversation-scoped

beans, 177–179course managed bean, 30, 34, 43DataListBean, 34DataScrollerBean, 30declaration attributes, 179defining MyFaces core components, 13EventCreatorBean, 59keeping data during multiple requests,

171managed conversation bean, 178moving from Struts frameworks to JSF,

10MyFaces delegating managed bean

construction to Spring, 287NewspaperTableBean, 39Person, 45problems with bean scopes in core JSF,

115ScheduleBean, 53synchronizing bean access, 245Tree2Bean, 47Tree2LazyLoadingBean, 51

managed-bean element, 17managed-bean-class element, 17managed-bean-name element, 17managed-bean-scope element, 17manual lifetime, conversations, 174–175Manual-scoped conversation, 174

configuring conversation-scopedmanaged beans, 177

invalidating in backing bean, 175invalidating manual conversation, 175invalidating using JSF components, 175

@ManyToOne annotationDynaForm component, 192

Map interface, 233Map Trick antipattern, 233–234mapping via annotations, ViewController,

182

■INDEX304

markupseparating Java code from, 3

markup attribute, Tobago controls, 217markup, Tobago

adding markup, 217–218progress control, 218style for supported markup, 218

master-detail user interface design,242–250

masterDetail managed bean, 243Maven Central Repository

dependencies, 71downloading Facelets, 69setting up Tomahawk, 22

max attributeRandomGeneratorTagHandler class,

102menu control, Tobago, 209menu.xhtml page

creating directory of related pages,76–77

menuBar facet, page tag, Tobago, 209menuBar tag, Tobago, 209menuCheckbox control, Tobago, 209menuItem tag, Tobago, 209menuRadio control, Tobago, 209menus

JSCookMenu component, Tomahawk,40

message APIclient-side conversion/validation,

Trinidad, 148–150message box

using pop-up as, Tobago, 211messageString parameter

format method,TrFastMessageFormatUtils, 150

META-INF folder, 81reusing custom tag library, 99trinidad-skins.xml, 158

MetaData class, 103MetaDataHandler class, 103MetaDataTarget class, 103MetaRule class, 103MetaRuleset class, 103

ignoreAll method, 108MetaTagHandler class, 103, 104metatags, Facelets, 103–110method invocation

parameterized method invocation, 233

min attribute,RandomGeneratorTagHandler, 102

minutesClass attribute, Schedule, 57modal dialog

displaying, Tobago, 211Model 2 architectural pattern, 4model values

update model values phase, JSF lifecycle, 8

Model, View, Controller pattern see MVCmonthClass attribute, Schedule, 57monthYearRowClass attribute, Calendar,

29mouseListener attribute, Schedule, 56multi value, selectable attribute

sheet control, Tobago, 208multipart forms, Tobago, 212MVC (Model, View, Controller) pattern

Java web frameworks, 4Struts framework, 9

MyFaces see Apache MyFacesMyFaces Extensions Filter

setting up Tomahawk, 21, 22MyFaces Orchestra Core15 dependency,

167MyFaces Tomahawk see TomahawkMyFaces Trinidad see Trinidadmyfaces-api.jar, 12

using RI, 71myfaces-impl.jar, 12

using RI, 71

■NN Plus One antipattern, 229–233name attribute

define tag, Facelets, 276endConversation tag, 180insert tag, Facelets, 278, 279param tag, Facelets, 280

navigationdialog navigations, Trinidad, 132JSCookMenu component, Tomahawk,

40navigation handler

render response phase, JSF life cycle, 8navigation menu page

creating directory of related pages,76–77

navigation rulesdefining MyFaces core components, 13

■INDEX 305

moving from Struts frameworks to JSF,10

pageFlowScope managing workflows,119

shipping address dialog example, 136writing MyFaces JSF application, 18

navigation-case element, navigation-rule,18

navigation-rule element, 18navigationMenuItem tag, 41NewCustomerBase class, 116, 119newCustomerBase.jspx, 115, 120NewCustomerConfirm class, 118, 119newCustomerConfirm.jspx, 117, 120newCustomerContact.jspx, 117, 120newspaperColumns attribute,

NewspaperTable, 39, 40newspaperOrientation attribute,

NewspaperTable, 40NewspaperTable component, Tomahawk,

24, 38–40attributes, 40newspaperColumns attribute, 39, 40

newspaperTable tag, 39NewspaperTableBean class, 39newsPoll

polling component, Trinidad, 125next facet, DataScroller component, 31None scope

determining scope, 242NonUniqueObjectException, Orchestra,

185number markup, Tobago, 217number-grouping-separator tag, trinidad-

config.xml, 162numberguess demonstration

downloading Facelets, 69

■OObject-Graph Navigation Language

(OGNL), 233object relational mapping (ORM), 167objects

Law of Demeter, 241–242OGNL expression language, 233ol tag

DataList rendering, 34onCheckNews event

polling component, Trinidad, 126onclick event handler

Ajax and JSF development, 254

one-to-many relationshipmaster-detail user interface design, 242

onload attribute, script tagenabling form-based authentication,

Tobago, 225onOutcome attribute, endConversation

tag, 180Open Session in View pattern, 229Open Transaction in View pattern, 229OpenTransactionInApplicationPhaseListe

ner class, 231OpenTransactionInViewFilter class, 229,

231, 233Oracle ADF Faces see Trinidadoracle-help-servlet-url tag, trinidad-

config.xml, 162Orchestra, 165–198

configuring Spring framework, 168–171configuring web.xml file, 167–168conversation context, 165Conversation scope, 165, 172conversation-related JSF tags, 179, 181conversations, 171–181

examples demonstrating, 172–173Spring Framework, 166

conversion scope, JSF, 10creating application with, 166–171downloading and installing, 166DynaForm component, 191–194managing events with ViewController,

165, 181–184managing persistence in, 165, 185–191reasons for using, 165using Orchestra converter, 191working at web tier, 166

Orchestra API, 196–198retrieving object representing

conversation, 173Orchestra architecture, 194–198

Conversation class, 196–197ConversationAware interface, 198ConversationContext class, 194–195ConversationManager class, 194, 197ConversationMessager interface, 198ConversationUtils class, 197FrameworkAdapter interface, 195RedirectTrackerNavigationHandler, 195RequestParameterProvider framework,

195UrlParameterNavigationHandler, 196Orchestra dependencies, 166–167

■INDEX306

common logging APIs, 167commons-logging, 167Java Persistence API, 166, 167MyFaces Orchestra Core15, 167Spring Framework, 166, 167

ordered data listcreating ordered DataList, 36–37

ordered rendering styleDataList component, 34, 38

ORM frameworkquerying in action method, 230

OTAPL (OpenTransactionInApplicationPhaseListener), 231

OTVF (OpenTransactionInViewFilter),229, 231, 233

out tags, columnssheet control, Tobago, 208

OutOfMemory exceptionsmanaging persistence in Orchestra, 186

output-mode tag, trinidad-config.xml, 162outputLabel component

creating inputTextLabeled component,86, 87

outputLabel tag, 65outputText element, 96

■PpaddingWidth/paddingHeight keys

LayoutableRendererBase class, 220page tag, Tobago, 226

menuBar facet, 209page-flow-scope-lifetime tag, trinidad-

config.xml, 162pageCountVar attribute

DataScroller component, 31, 33paginationSummary scroller, 33

pageFlowScope, Trinidad, 114–121accessing beans located in, 121alternative scope, 121customer registration example, 115–120managing workflows, 115–120programmatic access to, 120

pageIndexVar attributeDataScroller component, 31, 33paginationSummary scroller, 33

pagescreating directory of related pages,

72–79

paginationdataScroller component, Tomahawk, 29Table component, Trinidad, 154

pagination scroller, DataScroller, 33paginationSummary scroller, DataScroller,

33paginator attribute, DataScroller, 30, 33paginatorMaxPages attribute,

DataScroller, 30, 33panel control, Tobago, 227panelGroupLayout tag, Trinidad, 258panelTabbedPane tag, 44panes

TabbedPane component, Tomahawk, 42param tag, 280–281parameterized method invocation, 233PARAMETERS context parameter,

myfaces.ALGORITHM, 286parameters parameter

format method,TrFastMessageFormatUtils, 150

parrot.xhtml pagecreating directory of related pages,

77–78Partial Page Rendering see PPRpartial targets, 127partialSubmit attribute, Trinidad

Ajax and JSF development, 259converting string to uppercase using

PPR, 122inputListOfValues handling, 138

partialTriggers attribute, Trinidadadding PPR to custom components,

128converting string to uppercase using

PPR, 122polling component, 125programmatic PPR, 127support in custom component, 128

partialUpdateNotify method,RequestContext, 128

password attributeinput control, Tobago, 204

PasswordStrength classautoSubmit attribute, Trinidad, 124

passwordStrength.jspxautoSubmit attribute, Trinidad, 123

pathsLIBRARIES parameter, Facelets, 72

■INDEX 307

pattern attributeValidateRegExpr component, 45, 46

patternsMap Trick antipattern, 233–234Model 2 architectural pattern, 4Model, View, Controller (MVC) pattern,

4moving from Struts frameworks to JSF, 8N Plus One antipattern, 229–233Open Session in View pattern, 229Open Transaction in View pattern, 229Validating Setter antipattern, 267–269

performanceN Plus One antipattern, 229Trinidad context parameters for, 163

@PermitAll annotationsecurity for Tobago applications, 226

persistencemanaging in Orchestra, 165

persistence context, 185, 186persistence, Orchestra, 185–191

ConnectionManagerDataSource, 189Java Persistence API, 185–186JSF converters and persistence, 190–191transaction management, 188using conversation-scoped persistence,

173using non-JPA persistence

implementations, 189using Orchestra persistence support,

186–187using persistence with annotations,

187–188using persistence without annotations,

188PersistenceContext class, 189persistenceContextFactory class

create method, 189using non-JPA persistence

implementations, 189using Orchestra persistence support,

187persistentContextConversation

Interceptor, 187Person managed bean class, 45PersonBean.java

writing MyFaces JSF application, 16Pet Store application

demonstrating conversations, 173invalidating manual conversation, 175

PhaseListener

Ajax and JSF development, 252, 254avoiding risk in JSF life cycle, 233Déjà Vu PhaseListener, 234–235OpenTransactionInApplicationPhase

Listener class, 231thread safety, 239

phases, JSF life cycle, 6–8@platform instruction

skinning, Trinidad, 160platform-specific skinning, Trinidad, 160Pluggable Look and Feel (PLAF) API

skinning, Trinidad, 157point-to-point security, SSL, 262POJOs (plain old Java objects).

JSF expressing logic in, 262Polling class, 126polling component, Trinidad, 125–127polling.jspx, 125POM (Project Object Model)

adding dependency to, 69declaring JSF implementation, 71

pop-up calendar, creating, 27–28pop-ups, Tobago, 211PopulationChartModel class, 151popup facet

button control, Tobago, 211popupDateFormat attribute, Calendar, 27,

29popupXyz attributes, Calendar, 29portlet demonstration

downloading Facelets, 69portlet issues, 266–267PortletUtil class, 267POST request

Ajax and JSF development, 254postbacks

problems with managed bean scopes,JSF, 115

tree generation, 284@PostConstruct annotation

Validating Setter antipattern, 269PPR (Partial Page Rendering)

adding PPR to custom components,127–128

Ajax and JSF development, 258autoSubmit attribute, 123–125conversation lifetimes, 174converting string to uppercase using,

122executing PPR request from JavaScript,

128

■INDEX308

JavaScript, 122, 128–130JSF life cycle, 129notifying users of progress, 123partialSubmit attribute, 122partialTriggers attribute, 122, 125polling component, 125–127programmatic PPR, 127–128support for firing partial update

notifications, 128support for partialTriggers in custom

component, 128Tobago, 226–227Trinidad, 114, 121–130

PPR JavaScript API, 128–130Ajax requests, 129–130domReplaceListener, Ajax, 130file uploads, 129identifying request type, 129monitoring requests, 130RequestQueue class, 129sending PPR request, 128stateChangeListener, Ajax, 130TrXMLRequestEvent class methods, 130

@PreProcess annotation, ViewController,182

preProcess method, ViewController, 181@PreRenderView annotation,

ViewController, 182preRenderView method, ViewController,

181preserveDataModel attribute, DataList, 38PreserveToggle attribute, Tree2, 52previous facet, DataScroller component,

31process validations phase, JSF life cycle, 7programmatic access to pageFlowScope,

120programmatic PPR, Trinidad, 127–128

adding PPR to custom components,127–128

progress control, Tobago, 218Project Object Model see POMproject structure

creating directory of related pages, 73creating, Facelets, 70–71

■Qqueues, using in JSF

considering action methods, 233

■Rradio controls, Tobago

menuRadio control, 209selectOneRadio control, 206

RandomGeneratorTagHandler class, 101RangeChangeEvent

Table component, Trinidad, 154rangeChangeListener attribute

Table component, Trinidad, 154readonly attribute

input control, Tobago, 204Schedule component, 56

ready facetstatusIndicator component, Trinidad,

123recursive dependency injection, 238redirect element, navigation-case, 18redirection

problems with managed bean scopes,JSF, 115

RedirectTrackerNavigationHandler,Orchestra, 195

Reference Implementation (RI), 71REFRESH_PERIOD parameter, Facelets,

72regular expressions

ValidateRegExpr component, 44reject attribute, EmailValidator class, 145reload facet

panel control, Tobago, 227remote methods, using in JSF

considering action methods, 233remove tag, 282render kit

Trinidad render kit in faces-config.xml,113

render response phase, JSF, 8render-kit-id skin tag, Trinidad, 158renderAsPopup attribute, Calendar, 27, 29rendered attribute

debug tag, Facelets, 273input control, Tobago, 204

spacing controls, 213using pop-up as message box, 211

renderedPartially attribute, Tobago, 226RendererBase class, Tobago, 220Renderers

thread safety, 239rendererType attribute

@UIComponentTag annotation,Tobago, 223

■INDEX 309

rendering outputavoiding risk in JSF life cycle, 233creating Tobago controls, 220–222Facelets, 99JSF, 99JSP/JSF differences, 67partial rendering, Tobago, 226–227ViewHandler class, 99

renderPopupButtonAsImage attribute,Calendar, 27, 29

renderZeroLengthEntries attribute,Schedule, 56

repeat tag, 283–284forEach tag compared, 284jsfc attribute, 283value attribute, 283var attribute, 283

Request scopedetermining scope, 242, 245managed bean scopes available in JSF,

171managing independent windows, 176moving from Struts frameworks to JSF,

10problems with managed bean scopes,

JSF, 115thread safety, 239

request valuesapply request values phase, JSF life

cycle, 7RequestContext class, Trinidad, 114

accessing trinidad-config.xml options,163

addPartialTarget method, 127addPartialTriggerListeners method, 128Ajax and JSF development, 259getCurrentInstance method, 114isPartialRequest method, 127launchDialog method, 139partialUpdateNotify method, 128programmatic access to

pageFlowScope, 120retrieving RequestContext, 114returnFromDialog method, 133

RequestParameterProvider framework,Orchestra, 194, 195

RequestQueue class, 129requests

monitoring requests, Trinidad, 130non-JSF Ajax request parameters, 129

required attributeinput control, Tobago, 204

required field validators, 15resource bundles, 15resource management, Tobago, 216–217

pattern for locating resource paths, 216specifying additional paths, 216specifying expiration period for

resources, 228streaming static resources, 227unpacking/supplying by servlet

container, 228resource resolvers

custom resource resolvers, 108–110DefaultResourceResolver class, 109

ResourceServlet, Tobagoconfiguring web.xml, Tobago, 201

RESOURCE_RESOLVER parameter,Facelets, 72

custom resource resolvers, 110response headers

Ajax and JSF development, 254, 256responses

JSP/JSF writing output to, 67render response phase, JSF life cycle, 8

ResponseWriter classBUFFER_SIZE parameter, Facelets, 71

restore view phase, JSF life cycle, 7PhaseListener subscribing to, 234

ReturnEvent classdialog framework, Trinidad, 134

returnFromDialog method,RequestContext

dialog framework, Trinidad, 133Richmond theme, Tobago, 215right-to-left tag, trinidad-config.xml, 162@RolesAllowed annotation

security for Tobago applications, 225root parameter

launchDialog method, RequestContext,139

row selectionTable component, Trinidad, 156

rowBandingInterval attributeTable component, Trinidad, 157

rowCountVar attribute, DataList, 35rowIndexVar attribute, DataList, 35, 38rows attribute

DataList component, 38gridLayout tag, Tobago, 212

■INDEX310

rowsCountVar attribute, DataScroller, 33rowSelection attribute

Table component, Trinidad, 156RTL (right-to-left) languages

skinning, Trinidad, 160rules-based processing

commons-digester.jar, 12

■Ss:convertDateTime tag, 27sandbox

accessing, 218Tomahawk, 21, 22

saveState tag, 28conversations, 172

saveState tag, Tomahawkmaster-detail user interface design, 245view state encryption, 265

SAX (Simple API for XML)Facelets dependencies, 70

Scarborough theme, Tobago, 215Schedule component, Tomahawk, 25,

52–57attributes, 56–57Event Creator application, 59value attribute, 55, 56

schedule tag, 55ScheduleBean class, 53ScheduleModel interface, 55scope attribute

managed bean declaration, 179scopes

Application scope, 171Conversation scope, 172conversion scope, JSF, 10pageFlowScope, Trinidad, 114–121problems with managed bean scopes,

JSF, 115Request scope, 115, 171Session scope, 115, 171SpringConversationScope, 177, 178thread safety, 239

scrollableDataTable component, Faceletscreating, 91–95creating tag source file, 92–94registering tag in tag library, 94

scrollingdataScroller component, Tomahawk, 29pagination scroller, 33paginationSummary scroller, 33

SECRET context parameter, MyFaces, 285SecureLongConverter class, 265security

Tobago applications, 224–226enabling form-based authentication,

225SecurityException, 285select controls, Tobago, 206selectable attribute

sheet control, Tobago, 208selectedClass attribute, Schedule, 57selectedEntryClass attribute, Schedule, 57selectedIndex attribute, TabbedPane, 44selectOneMenu tag, 65selector composition

skinning, Trinidad, 161sendPartialFormPost method, TrPage

sending PPR request, 128, 129separateConversationContext tag

conversation-related JSF tags,Orchestra, 180

serverSideTabSwitch attribute,TabbedPane, 44

Servlet APIFacelets dependencies, 70

ServletContextListenerconfiguring, 288

servletsevolution of Java web frameworks, 2–3servlet program structure, 2, 3Trinidad resource servlet in web.xml

file, 112Session scope

conversations, 171determining scope, 242managed bean scopes available in JSF,

171managing independent windows, 176moving from Struts frameworks to JSF,

10problems with managed bean scopes,

JSF, 115thread safety, 239

sessionsbrowser windows and, 176

SetActionListener methodpageFlowScope managing workflows,

115vendor lock-in, 250

■INDEX 311

setAttribute methodConversation class, Orchestra, 197

setAttributes methodMetaDataHandler class, 103MetaTagHandler class, 107

setProperties methodFacelets and tags with behavior, 240

setPropertyActionListener tagmaster-detail user interface design, 248,

250vendor lock-in, 250

severity parameter, TrFacesMessage, 149sheet control, Tobago, 206–208

column tags, 207shipping address dialog example

dialog framework, Trinidad, 131–137ShowLines attribute, Tree2, 52ShowNav attribute, Tree2, 52ShowRootNode attribute, Tree2, 52showXyz attributes

sheet control, Tobago, 208simple rendering style

DataList component, 34, 38simpleColumn component, Facelets

creating, 89–91creating tag source file, 89–90registering tag in tag library, 90

size attribute, commandButton tagvendor lock-in, 251

skin configuration tags, Trinidad, 158skin-family tag, trinidad-skins.xml, 158,

159skinning, Trinidad, 114, 157–161

@agent instruction, 160alias selectors, 161blocking base skin properties, 161creating custom skin, 158–161CSS compression, 160declaration of aqua skin in trinidad-

skins.xml, 158default skin, 161@platform instruction, 160platform-specific skinning, 160RTL (right-to-left) languages, 160selector composition, 161skin configuration tags, 158skin style sheet, 158skinning single component, 159trinidad-skins.xml, 158turning on skins, 159

SKIP_COMMENTS parameter, Facelets,72, 282

slider control, Tobago, 218–224sortable attribute, column tag

sheet control, Tobago, 208Table component, Trinidad, 155

sortActionListener attributesheet control, Tobago, 208

SortEvent classTable component, Trinidad, 155

sortingTable component, Trinidad, 155–156

SortListener interfaceTable component, Trinidad, 155

sortProperty attribute, column elementTable component, Trinidad, 155

source elementinputTextLabeled component, Facelets,

88spanX/spanY attributes, cell tag, Tobago,

213Speyside theme, Tobago, 214Spring framework

applicationContext.xml file, 169configuring, Orchestra, 168–171declaring Conversation-scoped

managed beans, 172limitation of Spring dependency

injection, 287managing bean declarations, 177MyFaces delegating managed bean

construction to, 287Orchestra dependencies, 166, 167overriding JSF dependency injection,

287SpringConversationScope class

configuring conversation-scopedmanaged beans, 177

properties, 178src attribute

include tag, Facelets UI, 277SSL, 262Standard Template Library see JSTLstarterkit demonstration

downloading Facelets, 69startTime attribute, ScheduleModel, 55startup.bat file, 19startup.sh file, 19state attribute

sheet control, Tobago, 208state machine, JSF, 9

■INDEX312

stateChangeListener, Ajax, 130static method invocation, 233static typing, 236–239statusIndicator component, Trinidad

notifying users of progress, 123strings

converting to uppercase using PPR, 122strong markup, Tobago, 217Struts

action-oriented patterns, 9evolution of Java web frameworks, 4moving from Struts frameworks to JSF,

8–10MVC pattern, 9redirecting views, 9

Struts actions, 9Struts Application Framework see StrutsStruts Integration Library, 6Struts-Faces integration library, 9style map

rendering components, Tobago, 222style sheets

skin style sheet, 158style-sheet-name skin tag, Trinidad, 158styleClass attribute

DataList component, 38skinning components, Trinidad, 159

styleLocation attribute, JSCookMenu, 42SubForm component, Tomahawk, 25,

57–58submitOnClick attribute, Schedule, 56subtitle attribute, ScheduleModel, 55subtitleClass attribute, Schedule, 57summary parameter

client-side exception parameters, 149TrFacesMessage, 149

switchType attributetabGroup control, Tobago, 209

■Tt:dataList tag, 34t:dataScroller tag, 30t:div tag, 65t:inputCalendar, 65t:inputCalendar tag, 26t:inputText tag, 65t:inputTextarea tag, 65t:jscookMenu tag, 41t:navigationMenuItem tag, 41t:newspaperTable tag, 39t:outputLabel tag, 65

t:panelTabbedPane tag, 44t:saveState tag, 28t:schedule tag, 55t:selectOneMenu tag, 65t:tree2 tag, 47TabbedPane component, Tomahawk, 25,

42–44attributes, 44

tabContentStyleClass attribute,TabbedPane, 44

tabGroup control, Tobago, 209Table component, Trinidad, 153–157

appearance attributes, 157CollectionModel, 153column element, 153DataModel, 153detail toggling, 157detailStamp facet, 157header facet, 154headerText attribute, 154nesting columns to create column

groups, 154pagination, 154rangeChangeListener attribute, 154rowSelection attribute, 156SortEvent, 155sorting, 155–156SortListener, 155specifying column header, 154

tablescreating scrollableDataTable

component, 91–95NewspaperTable component,

Tomahawk, 38tabular data

displaying tabular data, 206@Tag annotation

tag declaration interface, Tobago, 223tag attributes

vendor lock-in, 251tag classes, Tobago, 223tag declaration interface

creating Tobago control, 223tag declaration using annotations,

224tag handlers

thread safety, 239tag libraries, Facelets, 81–84

creating, 81–83declaring functions, 83registering tag in tag library, 87–88

■INDEX 313

editableColumn component, 97inputTextLabeled component, 87scrollableDataTable component, 94simpleColumn component, 90

reusing custom tag library, 98–99Tag Library see taglibtag library declarations

setting up Tomahawk, 21setting up Trinidad, 111writing MyFaces JSF application, 15

Tag Library Descriptor (TLD)creating Tobago page, 202

tag source files, FaceletseditableColumn component, 96inputTextLabeled component, 86–87scrollableDataTable component, 92–94simpleColumn component, 89–90

tag-name element, FaceletsinputTextLabeled component, 88

@TagAttribute annotationtag declaration interface, Tobago, 223

TagDecorator classDECORATORS parameter, Facelets, 71

TagHandler classapply method, 102custom tag development, 100, 101extending, 102getAttribute method, 102getRequiredAttribute method, 102MetaTagHandler class, 103RandomGeneratorTagHandler class,

101TagHandler component, Facelets

custom tag development, 100–103taglib (Tag Library)

bird-functions.taglib.xml, 83creating tag libraries, 81–83setting up Tomahawk, 21Unified Expression Language and Tag

Library, 9using JSF without dependency on JSP

taglib, 9writing MyFaces JSF application, 15

TagLibrary class, 83tags

attributes definition in TagHandler, 101Facelets and tags with behavior,

240–241Facelets tag reference, 271–284mixing HTML with JSF tags, 10

targetsadding partial target programmatically,

127template attribute, Facelets

composition tag, 272decorate tag, 273

template folderTomahawk components, 25

template page, 73–74template.xhtml page, 73–74templates, Facelets, 85

box-template.xhtml, 274define-template.xhtml, 276encapsulating content for other pages,

272insert-template.xhtml, 278insert-template2.xhtml, 279inserting named content into, 276populating, 272reasons for using Facelets, 68specifying insertion points in, 278template attribute, 272, 273

templating library, 81templating support, JSF, 10text

inputTextLabeled component, 86–89textClass attribute, Schedule, 57theme attribute

JSCookMenu component, 42Schedule component, 56

themes, Tobago, 214–215adding markup, 217–218changing programmatically, 215Charlotteville theme, 215extending existing theme, 217fallback themes, 217obtaining configuration

programmatically, 221resource management, 216Richmond theme, 215Scarborough theme, 215serving directly out of theme JARs, 227Speyside theme, 214

thread safety, 239–240ThreadLocal class, 114tight coupling

Map Trick antipattern, 233time

convertDateTime tag, 27JSF DateTime, 27

■INDEX314

REFRESH_PERIOD parameter, Facelets,72

UTC time zone, 27time-zone tag, trinidad-config.xml, 162timeout property,

SpringConversationScope, 178titleClass attribute, Schedule, 57to-view-id element, navigation-case, 18Tobago, 199

access keys, 204address book example, 199advanced components, JSF, 10avoiding complete page reloads, 226blank example, 199command usage, 205compatible JSF implementations, 228configuring tobago-config.xml file, 202configuring web descriptor (web.xml),

201creating application with, 200–202creating Tobago controls, 218–224creating Tobago page, 202demonstration example, 199dependencies, 200displaying modal dialog, 211displaying tabular data, 206double request prevention mechanism,

206downloading latest distribution, 200downloading examples, 199enabling form-based authentication,

225Facelets view definition support, 203handling multipart form data requests,

212labels, 204layout management, 212–214online demonstration, 200partial rendering, 226–227placing menu bar at top of page, 209pop-ups, 211rendering different content on same

area, 209rendering groups of buttons, 210resource management, 216–217security for Tobago applications,

224–226themes, 214–215transition attribute, pages, 206validating input, 204virtual forms, 226

Tobago componentsrendering components, 220–222UIComponent, 219–220

Tobago controls, 203–212basic controls, 203–206button control, 205command control, 206creating Tobago controls, 218–224

accessing sandbox, 218defining JSP tag, 223–224defining tag class, 223defining tag declaration interface, 223rendering components, 220–222user interface component, 219–220

file select control, 211input control, 204–205link control, 205menu control, 209progress control, 218select controls, 206sheet control, 206–208tabGroup control, 209toolBar control, 210tree control, 203

tobago-config.xml file, 202, 216tobago-core.jar file, 202tobago-fileupload.jar file, 212tobago-security package, 225tobago-theme.xml file, 200TobagoMultipartFormdataFilter filter, 212TobagoTag class, 223Tomahawk, 21–65

advanced components, JSF, 10Apache MyFaces extension

components, 11Event Creator application, 58–65file structure of sample components, 25inputSuggestAjax component, 105installing, 11sandbox subproject, 21scrollableDataTable component,

creating, 92tag/component libraries, 81

Tomahawk components, 24–58Calendar, 24, 25–29DataList, 24, 34–38DataScroller, 24, 29–33JSCookMenu, 24, 40–42NewspaperTable, 24, 38–40Schedule, 25, 52–57SubForm, 25, 57–58

■INDEX 315

TabbedPane, 25, 42–44Tree2, 25, 47–52ValidateRegExpr, 25, 44–46

Tomahawk tag librarydisplayValueOnly attribute, 23features, 22–25forceId attribute, 23setting up, 21–22

tomahawk.jar, 12Tomcat servlet

configuring Apache MyFaces, 13running MyFaces JSF application, 19

toolBar control, Tobago, 210toolBarCommand tag, Tobago, 210tooltip attribute, Schedule, 56ToUppercase class, 122toUppercase.jspx, 122Tr prefix, 148tr-inhibit

skinning, Trinidad, 161tr-rule-ref

skinning, Trinidad, 161@Transactional annotation, 188transition attribute, Tobago pages, 206TrConverterException, 145, 148tree control, Tobago, 203tree generation

Facelet class, 100Facelets and JSP compared, 100Facelets building stateless tree, 100forEach tag, 284inserting new instance into JSF tree, 271postbacks, 284

Tree2 component, Tomahawk, 25, 47–52attributes, 52ClientSideToggle attribute, 51, 52lazy loading, 51value attribute, 47, 52

tree2 tag, 47Tree2Bean class, 47Tree2LazyLoadingBean class, 51TreeNodeBase class

description parameter, constructor, 50getChildren method, 51isLeaf parameter, constructor, 50type parameter, constructor, 50

treesUIComponent tree, 272

TrFacesMessage class, Trinidadclient-side messages, 149

TrFastMessageFormatUtils class, Trinidad,149

instantiating client-side messages, 150Trinidad, 111–164

autoSubmit attribute, 123–125client-side conversion and validation,

140–150ClientConverter interface, 141configuration, 140–141, 161–163context parameters for performance,

163dialog framework, 114, 130–140downloading, 111extended JSF capabilities, 113–150features, 114JavaScript API, 128–130pageFlowScope, 114–121Partial Page Rendering (PPR), 114,

121–130adding PPR to custom components,

127–128programmatic PPR, 127–128

partialSubmit attribute, 122partialTriggers attribute, 122, 125reasons for using, 113RequestContext class, 114setup, 111–113skinning, 157–161tag libraries, 81TrFastMessageFormatUtils class, 149tuning, 163

Trinidad components, 150–157adding PPR to custom components,

127–128advanced components, JSF, 10Chart component, 150–153component libraries, 81CSS selectors customizing, 159inputListOfValues component, 138polling component, 125–127reasons for using Trinidad, 113skinning, 159statusIndicator component, 123Table component, 153–157

trinidad-config.xml file, 161accessing options, 163configuration, 140, 162

trinidad-skins.xml file, 158Triple DES encryption algorithm, 286TrPage class

sendPartialFormPost method, 128, 129

■INDEX316

TrValidatorException, 147, 148TrXMLRequestEvent class, 130tuning, Trinidad, 163two-digit-year-start tag, trinidad-

config.xml, 162tx prefix, Tobago, 204type parameter, TreeNodeBase, 50types

static typing, 236–239

■Uui:component tag see component tagui:composition tag see composition tagui:debug tag, 273ui:decorate tag see decorate tagui:define tag see define tagui:fragment tag see fragment tagui:include tag see include tagui:insert tag see insert tagui:param tag, 280–281ui:remove tag, 282ui:repeat tag see repeat taguiComponent attribute

@UIComponentTag annotation,Tobago, 223

UIComponent classcreating Tobago controls, 219–220

UIComponent elementsFacelets architecture, 99, 100inserting into component tree, 277inserting new instance into JSF tree, 271referencing UIComponent instance, 271

UIComponent tree, 272@UIComponentTag annotation, 223UIComponentTag class, 223

Facelets and tags with behavior, 240@UIComponentTagAttribute annotation,

223UIViewRoot class, Facelets, 99, 100ul tag

DataList rendering, 34UML

modeling state diagrams in UML, 9unbind method, PersistenceContext, 189unevenClass attribute, Schedule, 57Unified EL (Unified Expression Language),

80inline text, 80parameterized method invocation, 233reasons for using Facelets, 68Tag Library and, 9

unordered data listcreating unordered DataList, 35–36

unordered rendering styleDataList component, 34, 38

update model values phase, JSF life cycle,8

update notificationssupport for firing partial update

notifications, 128UpdateActionListener method, 250updateScheduleView method,

EventCreatorBean, 63uploaded-file-processor tag, trinidad-

config.xml, 163url parameter

non-JSF Ajax requests, 129UrlParameterNavigationHandler,

Orchestra, 196user interface design

master-detail, 242–250username property, Email class, 142useWindow attribute/parameter

dialog framework, Trinidad, 130, 133inputListOfValues handling, 138launchDialog method, RequestContext,

139USE_APPLICATION_VIEW_CACHE

parameter, Trinidad, 163UTC time zone, 27

■Vvalidate method, EmailValidator class,

140, 147ValidateDelegateHandler class, 107validateFileItem tag, Tobago, 212ValidateHandler class, 107ValidateRegExpr component, Tomahawk,

25, 44–46pattern attribute, 45, 46

Validating Setter antipattern, 267–269validation

custom validation handlers, Facelets,107–108

process validations phase, JSF life cycle,7

validation feature, MyFaces, 238validation phase, JSF life cycle, 141validation, Trinidad

client-side conversion and validation,140–150

■INDEX 317

client-validation tag, trinidad-config.xml, 162

e-mail conversion and validationexample, 141–148

faces-config.xml file, 148inline client-side validation, 140providing custom tag for validator, 148

ValidatorException, 147validators

avoiding risk in JSF life cycle, 233JSF features, 5thread safety, 240writing MyFaces JSF application, 15

value attributeDataList component, 34, 38displayValueOnly attribute, 23file tag, Tobago, 211input control, Tobago, 204inputTextLabeled component, Facelets,

87param tag, Facelets UI, 280repeat tag, Facelets UI, 283Schedule component, 55, 56sheet control, Tobago, 207Tree2 component, 47, 52

ValueHolder interfaceJSF development, 261

var attributeDataList component, 38RandomGeneratorTagHandler class,

102repeat tag, Facelets UI, 283sheet control, Tobago, 207Tree2 component, 52

VariableResolver, ELoverriding JSF dependency injection,

287varNodeToggler attribute, Tree2, 52vendor lock-in, 250–251verticalGridVisible attribute

Table component, Trinidad, 157view handler

render response phase, JSF life cycle, 8view state encryption, 262–266

MyFaces, 285–286SECRET context parameter, 285

@ViewController annotation, 182ViewController interface, 181

customizing ViewController, 183finding life cycle methods, 182JSF converters and persistence, 190

managing events with, 165, 181–184mapping via annotations, 182mapping views to beans, 182requiring conversations, 184

ViewControllerManager, 183viewDetail method, masterDetail bean,

244, 245, 247viewDetails event handler, 254viewDetails function, 257viewDetails method, 16, 259viewDetailsCallback function, 255ViewHandler class

extending, 110Facelets architecture, 99Facelets replacing JSF default, 72

viewscreating composite views, Facelets, 272creating JSF views, 72–79OpenTransactionInViewFilter class, 229redirecting views, Struts, 9restore view phase, JSF life cycle, 7

virtual forms, Tobago, 226visibleEndHour attribute, Schedule, 56visibleStartHour attribute, Schedule, 56

■WWAR files

downloading Facelets, 69web applications

developing using templates, 85web containers, Facelets, 68web descriptor see web.xml fileweb pages

creating directory of related pages,72–79

web services, using in JSFconsidering action methods, 233

web tierOrchestra working at, 166

WEB-INF directorycreating directory of related pages, 73trinidad-skins.xml, 158

web.xml fileApache MyFaces, 12creating directory of related pages, 73creating inputTextLabeled component,

88creating simpleColumn component, 90disabling content compression, 160Facelets, 71–72initialization parameters, 71

■INDEX318

Orchestra, 167–168registering tag library, 83Tobago, 201Tomahawk, 21, 22Trinidad, 111, 112

WebSphere 6.0configuring Apache MyFaces, 13

weekClass attribute, Schedule, 57weekRowClass attribute, Calendar, 29welcome.jsp

writing MyFaces JSF application, 18WidgetTag class, 241window independence

conversation context groupings, 180windowProperties parameter

launchDialog method, RequestContext,139

wizards, 114workflows, 114

see also conversationspageFlowScope managing, 115–120

workingEndHour attribute, Schedule, 56workingStartHour attribute, Schedule, 56

■XXML Hell, 235–236XML SAX

Facelets dependencies, 70XML tags

converting at compile time via jsfcattribute, 85

■INDEX 319