foreword |
|
xxi | |
preface |
|
xxiii | |
acknowledgments |
|
xxv | |
about this book |
|
xxvii | |
about the title and cover |
|
xxxiii | |
PART 1 EXPLORING JAVASERVER FACES |
|
1 | (274) |
|
1 IntroducingJavaServer Faces |
|
|
3 | (35) |
|
1.1 It's a RAD-ical world |
|
|
4 | (6) |
|
So, what is JavaServer Faces? |
|
|
5 | (5) |
|
|
10 | (1) |
|
1.2 The technology under the hood |
|
|
10 | (6) |
|
Hypertext Transfer Protocol (HTTP) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
JSP and other display technologies |
|
|
15 | (1) |
|
1.3 Frameworks, frameworks, frameworks |
|
|
16 | (3) |
|
Why do we need frameworks? |
|
|
16 | (1) |
|
|
17 | (1) |
|
JSF, Struts, and other frameworks |
|
|
18 | (1) |
|
1.4 Components everywhere |
|
|
19 | (3) |
|
|
22 | (15) |
|
|
24 | (7) |
|
|
31 | (1) |
|
Examining the HelloBean class |
|
|
32 | (2) |
|
Configuration with faces-config.xml |
|
|
34 | (2) |
|
Configuration with web.xml |
|
|
36 | (1) |
|
|
37 | (1) |
|
|
38 | (50) |
|
2.1 The key pieces of the pie |
|
|
39 | (18) |
|
User interface components |
|
|
41 | (2) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (3) |
|
|
48 | (1) |
|
|
49 | (6) |
|
|
55 | (1) |
|
|
56 | (1) |
|
2.2 The Request Processing Lifecycle |
|
|
57 | (12) |
|
|
61 | (2) |
|
Phase 2: Apply Request Values |
|
|
63 | (2) |
|
Phase 3: Process Validations |
|
|
65 | (1) |
|
Phase 4: Update Model Values |
|
|
66 | (1) |
|
Phase 5: Invoke Application |
|
|
66 | (2) |
|
|
68 | (1) |
|
2.3 Understanding component and client identifiers |
|
|
69 | (7) |
|
|
72 | (1) |
|
|
73 | (3) |
|
2.4 Exploring the JSF expression language |
|
|
76 | (10) |
|
Understanding scoped variables |
|
|
80 | (1) |
|
|
81 | (2) |
|
Using the EL with components |
|
|
83 | (3) |
|
|
86 | (2) |
|
3 Warming up: getting around JSF |
|
|
88 | (49) |
|
3.1 Setting up your JSF environment |
|
|
89 | (13) |
|
|
89 | (1) |
|
Choosing a JSF implementation |
|
|
89 | (1) |
|
|
90 | (2) |
|
|
92 | (10) |
|
|
102 | (8) |
|
|
103 | (1) |
|
Using JSF with JSTL and other JSP custom tags |
|
|
104 | (6) |
|
3.3 Creating and initializing beans |
|
|
110 | (19) |
|
|
113 | (10) |
|
Declaring Lists and Maps as managed beans |
|
|
123 | (2) |
|
Setting values with value-binding expressions |
|
|
125 | (4) |
|
3.4 Navigating the sea of pages |
|
|
129 | (7) |
|
|
136 | (1) |
|
4 Getting started with the standard components |
|
|
137 | (48) |
|
4.1 It's all in the components |
|
|
138 | (10) |
|
|
142 | (1) |
|
|
143 | (2) |
|
|
145 | (3) |
|
The render kit behind the scenes |
|
|
148 | (1) |
|
4.2 Common component properties |
|
|
148 | (1) |
|
4.3 Controlling the page with UIViewRoot |
|
|
149 | (2) |
|
4.4 Setting component parameters with UIParameter |
|
|
151 | (2) |
|
4.5 Displaying data with the Output components |
|
|
153 | (14) |
|
Displaying ordinary text with HtmlOutputText |
|
|
153 | (14) |
|
Using UIOutput with the [f:verbatim] tag |
|
|
|
155 Creating input labels with HtmlOutputLabel |
|
|
|
158 Using HtmlOutputFormat for parameterized text |
|
|
|
160 Displaying hyperlinks with HtmlOutputLink |
|
|
|
|
|
4.6 Displaying images with HtmlGraphicImage |
|
|
167 | (2) |
|
4.7 Displaying component messages with HtmlMessage |
|
|
169 | (3) |
|
4.8 Displaying application messages with HtmlMessages |
|
|
172 | (4) |
|
4.9 Grouping and layout with the Panel components |
|
|
176 | (8) |
|
Grouping components with HtmlPanelGroup |
|
|
176 | (2) |
|
Creating tables with HtmlPanelGrid |
|
|
178 | (6) |
|
|
184 | (1) |
|
5 Using the input and data table components |
|
|
185 | (49) |
|
5.1 Registering event listeners |
|
|
186 | (3) |
|
Declaring value-change listeners |
|
|
187 | (1) |
|
Declaring action listeners |
|
|
187 | (2) |
|
5.2 Common component properties |
|
|
189 | (1) |
|
5.3 Handling forms with HtmlForm |
|
|
190 | (2) |
|
5.4 Handling basic user input |
|
|
192 | (6) |
|
Declaring basic text fields with HtmlInputText |
|
|
193 | (1) |
|
Using HtmlInputTextarea for memo fields |
|
|
194 | (1) |
|
Displaying password fields with HtmlInputSecret |
|
|
195 | (2) |
|
Declaring hidden fields with HtmlInputHidden |
|
|
197 | (1) |
|
5.5 Using HtmlSelectBooleanCheckbox for checkboxes |
|
|
198 | (1) |
|
|
199 | (6) |
|
Using UISelectltem for single items |
|
|
200 | (3) |
|
Using UISelectltems for multiple items |
|
|
203 | (2) |
|
5.7 Handling multiple-item selections |
|
|
205 | (7) |
|
Using HtmlSelectManyCheckbox for checkbox groups |
|
|
205 | (3) |
|
Displaying listboxes with HtmlSelectManyListbox |
|
|
208 | (2) |
|
Using HtmlSelectManyMenu for single-item listboxes |
|
|
210 | (2) |
|
5.8 Handling single-item selections |
|
|
212 | (7) |
|
Using HtmlSelectOneRadio for radio button groups |
|
|
212 | (3) |
|
Using single-select listboxes with HtmlSelectOneListbox |
|
|
215 | (2) |
|
Declaring combo boxes with HtmlSelectOneMenu |
|
|
217 | (2) |
|
5.9 Executing application commands |
|
|
219 | (135) |
|
Declaring buttons with HtmlCommandButton |
|
|
219 | (2) |
|
Creating an action link with HtmlCommandLink |
|
|
221 | (2) |
|
5.10 Displaying data sets with HtmlDataTable |
|
|
223 | (10) |
|
|
233 | (1) |
|
6 Internationalization, validators, and converters |
|
|
234 | (41) |
|
6.1 Internationalization and localization |
|
|
235 | (10) |
|
|
236 | (2) |
|
Creating resource bundles |
|
|
238 | (3) |
|
Using resource bundles with components |
|
|
241 | (3) |
|
Internationalizing text from back-end code |
|
|
244 | (1) |
|
|
245 | (6) |
|
|
245 | (1) |
|
|
246 | (1) |
|
Using the standard validators |
|
|
247 | (4) |
|
Combining different validators |
|
|
251 | (1) |
|
6.3 Type conversion and formatting |
|
|
251 | (18) |
|
|
254 | (1) |
|
Working with the standard converters |
|
|
255 | (14) |
|
6.4 Customizing application messages |
|
|
269 | (4) |
|
|
273 | (2) |
PART 2 BUILDING USER INTERFACES |
|
275 | (132) |
|
7 Introducing ProjectTrack |
|
|
277 | (10) |
|
|
278 | (3) |
|
|
281 | (2) |
|
|
283 | (1) |
|
|
284 | (2) |
|
|
286 | (1) |
|
8 Developing a user interface without Java code: the Login page |
|
|
287 | (29) |
|
|
289 | (2) |
|
|
289 | (1) |
|
Setting up faces-config.xml |
|
|
290 | (1) |
|
8.2 Creating the Login page |
|
|
291 | (9) |
|
Starting with HtmlGraphicImage and HtmlOutputText components |
|
|
292 | (3) |
|
|
295 | (5) |
|
|
300 | (4) |
|
Using an image for the button |
|
|
301 | (1) |
|
Integrating with JavaScript |
|
|
301 | (2) |
|
Adding Cascading Style Sheets |
|
|
303 | (1) |
|
|
304 | (4) |
|
Customizing validation messages |
|
|
307 | (1) |
|
8.5 Improving layout with HtmlPanelGrid |
|
|
308 | (6) |
|
|
314 | (2) |
|
9 Developing a user interface without Java code: the other pages |
|
|
316 | (38) |
|
9.1 Building the header with a custom component |
|
|
317 | (7) |
|
Using a custom toolbar component |
|
|
321 | (2) |
|
Configuring the navigation rule |
|
|
323 | (1) |
|
9.2 Prototyping data tables with panels |
|
|
324 | (7) |
|
|
325 | (4) |
|
Configuring the navigation rule |
|
|
329 | (1) |
|
|
330 | (1) |
|
Configuring the navigation rule |
|
|
330 | (1) |
|
|
331 | (16) |
|
The Approve a Project page |
|
|
331 | (6) |
|
Configuring the navigation rule |
|
|
337 | (1) |
|
The Reject a Project page |
|
|
338 | (3) |
|
Configuring the navigation rule |
|
|
341 | (1) |
|
The Create a Project page |
|
|
341 | (6) |
|
Configuring the navigation rule |
|
|
347 | (1) |
|
9.4 The Project Details page |
|
|
347 | (6) |
|
Configuring the navigation rule |
|
|
351 | (2) |
|
|
353 | (1) |
|
10 Integrating application functionality |
|
|
354 | (44) |
|
10.1 Understanding JSF development approaches |
|
|
355 | (2) |
|
10.2 Exploring the application environment |
|
|
357 | (3) |
|
10.3 Reorganizing pages for security |
|
|
360 | (1) |
|
|
360 | (5) |
|
Updating the navigation rule |
|
|
364 | (1) |
|
|
365 | (5) |
|
Updating the navigation rule |
|
|
369 | (1) |
|
10.6 Integrating data grids |
|
|
370 | (9) |
|
|
370 | (8) |
|
|
378 | (1) |
|
10.7 Integrating input forms |
|
|
379 | (11) |
|
|
379 | (3) |
|
The Approve a Project page |
|
|
382 | (3) |
|
The Reject a Project page |
|
|
385 | (1) |
|
The Create a Project page |
|
|
386 | (4) |
|
10.8 The Project Details page |
|
|
390 | (6) |
|
Updating the navigation rule |
|
|
395 | (1) |
|
10.9 Adding an error page |
|
|
396 | (2) |
|
|
397 | (1) |
|
Updating the navigation rule |
|
|
397 | (1) |
|
10.10 Internationalizing and localizing the UI |
|
|
398 | (6) |
|
Externalizing text into the resource bundle |
|
|
398 | (2) |
|
Internationalizing the header |
|
|
400 | (2) |
|
|
402 | (2) |
|
|
404 | (3) |
PART 3 DEVELOPING APPLICATIONS LOGIC |
|
407 | (1) |
|
|
409 | (194) |
|
11.1 From servlets to JSF |
|
|
410 | (3) |
|
11.2 The application foundation |
|
|
413 | (6) |
|
|
413 | (4) |
|
|
417 | (2) |
|
11.3 It's all in the context |
|
|
419 | (9) |
|
|
420 | (2) |
|
|
422 | (2) |
|
|
424 | (4) |
|
|
428 | (10) |
|
|
430 | (2) |
|
|
432 | (2) |
|
Handling value-change events |
|
|
434 | (1) |
|
|
435 | (3) |
|
11.5 Components revisited |
|
|
438 | (17) |
|
|
442 | (4) |
|
|
446 | (3) |
|
|
449 | (2) |
|
|
451 | (2) |
|
SelectItem and SelectItemGroup model beans |
|
|
453 | (2) |
|
|
455 | (1) |
|
12 Building an application: design issues and foundation classes |
|
|
456 | (1) |
|
|
457 | (3) |
|
|
460 | (13) |
|
The importance of toString |
|
|
461 | (1) |
|
Serialization for breakfast |
|
|
462 | (1) |
|
Its all in the properties |
|
|
462 | (10) |
|
|
472 | (1) |
|
12.3 Exploring the business layer and data layers |
|
|
473 | (3) |
|
12.4 Developing the application layer |
|
|
476 | (15) |
|
|
478 | (2) |
|
Organizing utility methods |
|
|
480 | (2) |
|
|
482 | (2) |
|
Adapting business objects |
|
|
484 | (7) |
|
12.5 Writing a visit object for session state |
|
|
491 | (3) |
|
12.6 Developing a base backing bean class |
|
|
494 | (4) |
|
|
498 | (1) |
|
13 Building an application: backing beans, security, and internationalization |
|
|
499 | (1) |
|
13.1 Writing backing beans |
|
|
500 | (45) |
|
|
501 | (1) |
|
|
501 | (4) |
|
Performing authentication |
|
|
505 | (6) |
|
Listing projects with UIData and parameterizing listeners |
|
|
511 | (11) |
|
|
522 | (6) |
|
|
528 | (6) |
|
Paging through the project history with UIData |
|
|
534 | (6) |
|
Working with JDBC ResultSets and UIData |
|
|
540 | (5) |
|
|
545 | (6) |
|
Container-based vs. custom security |
|
|
546 | (1) |
|
|
547 | (4) |
|
13.3 Supporting internationalization in code |
|
|
551 | (11) |
|
Internationalizing text with resource bundles |
|
|
552 | (5) |
|
Internationalizing messages |
|
|
557 | (5) |
|
13.4 Design consequences and alternatives |
|
|
562 | (4) |
|
Accessing the business layer |
|
|
562 | (1) |
|
Organizing beans by function |
|
|
563 | (1) |
|
Action methods implemented by backing beans |
|
|
564 | (1) |
|
Initializing backing bean properties with the Managed Bean Creation facility |
|
|
565 | (1) |
|
|
566 | (2) |
|
14 Integrating JSF with Struts and existing applications |
|
|
568 | (1) |
|
14.1 What integration means |
|
|
569 | (1) |
|
14.2 When to use JSF with other frameworks |
|
|
569 | (2) |
|
14.3 The many faces of requests and responses |
|
|
571 | (1) |
|
14.4 Integrating JSF with Struts applications |
|
|
572 | (28) |
|
|
575 | (2) |
|
Migrating Struts JSP tags |
|
|
577 | (20) |
|
Using JSF action methods and managed beans |
|
|
597 | (2) |
|
|
599 | (1) |
|
14.5 Integrating JSF with non-Struts applications |
|
|
600 | (1) |
|
|
601 | (2) |
PART 4 WRITING CUSTOM COMPONENTS, RENDERERS, VALIDATORS, AND CONVERTERS |
|
603 | (1) |
|
15 The JSF environment: a component developer's perspective |
|
|
605 | (98) |
|
15.1 Three steps to UI extension nirvana |
|
|
606 | (1) |
|
15.2 Developing UI components |
|
|
607 | (29) |
|
Deciding when to write a UI component |
|
|
608 | (2) |
|
|
610 | (13) |
|
Event handling with method bindings |
|
|
623 | (1) |
|
|
624 | (3) |
|
|
627 | (9) |
|
15.3 Developing renderers |
|
|
636 | (12) |
|
Deciding when to write a renderer |
|
|
640 | (1) |
|
|
641 | (2) |
|
|
643 | (1) |
|
|
644 | (3) |
|
|
647 | (1) |
|
15.4 Developing validators |
|
|
648 | (6) |
|
|
649 | (1) |
|
|
650 | (2) |
|
|
652 | (2) |
|
15.5 Developing converters |
|
|
654 | (6) |
|
|
654 | (3) |
|
|
657 | (1) |
|
|
658 | (2) |
|
15.6 Handling internationalization |
|
|
660 | (1) |
|
15.7 Packaging UI extensions |
|
|
660 | (1) |
|
|
661 | (4) |
|
appendix A: Using JSF without JSP |
|
|
665 | (10) |
|
|
675 | (4) |
|
|
679 | (24) |
ONLINE EXTENSION |
|
PART 5 WRITING CUSTOM COMPONENTS, RENDERERS, VALIDATION, AND CONVERTERS: EXAMPLES |
|
703 | (1) |
|
16 UIInputDate: a simple input component |
|
|
705 | |
|
16.1 Writing the UIInputDate class |
|
|
708 | (10) |
|
|
709 | (6) |
|
|
715 | (2) |
|
Implementing StateHolder methods |
|
|
717 | (1) |
|
16.2 Registering the component |
|
|
718 | (1) |
|
|
718 | (6) |
|
Writing the JSP custom tag |
|
|
718 | (3) |
|
|
721 | (1) |
|
Adding the tag to the tag library |
|
|
722 | (2) |
|
|
724 | (2) |
|
|
726 | (1) |
|
17 RolloverButton renderer: a renderer with JavaScript support |
|
|
727 | (2) |
|
17.1 Writing the RolloverButtonRenderer class |
|
|
729 | (8) |
|
|
731 | (4) |
|
|
735 | (1) |
|
|
736 | (1) |
|
|
737 | (11) |
|
Writing the HtmlBaseTag class |
|
|
738 | (3) |
|
Writing the JSP custom tag |
|
|
741 | (3) |
|
|
744 | (1) |
|
Adding the tag to the tag library |
|
|
745 | (3) |
|
|
748 | (2) |
|
17.4 Wrapping an existing renderer |
|
|
750 | (4) |
|
Developing the RolloverButtonDecoratorRenderer class |
|
|
750 | (4) |
|
|
754 | (2) |
|
18 UIHeadlineViewer: a composite, data-aware component |
|
|
756 | (2) |
|
18.1 RSS and the Informa API |
|
|
758 | (5) |
|
18.2 Using UIData with Informa |
|
|
763 | (2) |
|
18.3 Subclassing DataModel |
|
|
765 | (3) |
|
18.4 Writing the UIHeadlineViewer class |
|
|
768 | (12) |
|
18.5 Registering the component |
|
|
780 | (1) |
|
|
781 | (8) |
|
Writing the JSP custom tag |
|
|
781 | (6) |
|
Adding the tag to the tag library |
|
|
787 | (2) |
|
|
789 | (4) |
|
|
793 | (1) |
|
19 UINavigator: a model-driven toolbar component |
|
|
794 | (2) |
|
19.1 Writing the model classes |
|
|
796 | (5) |
|
19.2 Writing the UINavigator class |
|
|
801 | (9) |
|
Implementing ActionSource methods |
|
|
803 | (3) |
|
Overriding UIComponentBase methods |
|
|
806 | (1) |
|
Implementing StateHolder methods |
|
|
807 | (2) |
|
Developing NavigatorActionListener: a custom ActionListener |
|
|
809 | (1) |
|
19.3 Registering the component |
|
|
810 | (1) |
|
19.4 Writing the ToolbarRenderer class |
|
|
811 | (10) |
|
|
811 | (9) |
|
|
820 | (1) |
|
19.5 Registering the renderer |
|
|
821 | (1) |
|
|
822 | (12) |
|
Writing the Navigator_ToolbarTag component tag |
|
|
822 | (4) |
|
Writing the NavigatorItemTag tag handler |
|
|
826 | (5) |
|
Adding the tags to the tag library |
|
|
831 | (3) |
|
|
834 | (4) |
|
|
838 | (1) |
|
20 Validator and converter examples |
|
|
839 | (1) |
|
20.1 Validator methods vs. validator classes |
|
|
840 | (1) |
|
20.2 Developing a validator |
|
|
840 | (14) |
|
Writing the RegularExpressionValidator class |
|
|
842 | (5) |
|
Registering the validator |
|
|
847 | (1) |
|
|
847 | (5) |
|
|
852 | (2) |
|
20.3 When custom converters are necessary |
|
|
854 | (1) |
|
20.4 Developing a converter |
|
|
854 | (18) |
|
Writing the UserConverter class |
|
|
856 | (9) |
|
Registering the converter |
|
|
865 | (5) |
|
JSP integration 866 Using the converter |
|
|
870 | (2) |
|
|
872 | (1) |
|
appendix B: A survey of JSF IDEs and implementations |
|
|
873 | (62) |
|
appendix C: Extending the core JSF classes |
|
|
935 | (23) |
|
appendix D: JSF configuration |
|
|
958 | (18) |
|
appendix E: Time zone, country, language, and currency codes |
|
|
976 | |