ebook img

Apache MyFaces Trinidad 1.2: A Practical Guide PDF

292 Pages·2009·2.2 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Apache MyFaces Trinidad 1.2: A Practical Guide

Apache MyFaces Trinidad 1.2 A Practical Guide Develop JSF web applications with Trinidad and Seam David Thomas BIRMINGHAM - MUMBAI This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Apache MyFaces Trinidad 1.2 A Practical Guide Copyright © 2009 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: November 2009 Production Reference: 1031109 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847196-08-8 www.packtpub.com Cover Image by Vinayak Chittar ([email protected]) Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Credits Author Editorial Team Leader David Thomas Akshara Aware Reviewers Project Team Leader Cagatay Civici Lata Basantani Simon Lessard Project Coordinator Rajashree Hamine Acquisition Editor Rashmi Phadnis Proofreader Jeff Orloff Development Editors Rakesh Shejwal Siddharth Mangarole Graphics Nilesh Mohile Technical Editor Mehul Shetty Production Coordinator Shantanu Zagade Indexer Monica Ajmera Cover Work Shantanu Zagade Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 About the Author David Thomas is a developer and technical project manager of Java-based web applications, and has well over 10 years of experience in various web technologies. He began writing applications based on the Common Gateway Interface (CGI), HTML and Javascript, with a short Java Applets interlude. The main occupation with Java began when Java took charge of the server. A series of Java Servlet applications were developed using an early, self-built Model-2 controller architecture. Java Server Pages (JSP) took hold for a rather long time and a couple of major, increasingly complex, web applications were developed in combination with Struts. This also included the development of major portal applications in the finance and banking sector. Shortly after Java Server Faces 1.2 (JSF) emerged, began the development of a major JSF web application including the development of a high-level framework based on Apache My Faces Trinidad, Facelets and JBOSS Seam in the area of controlling. This project spawned a couple of sub projects, so development continues up to the present day. This is the author's first book which is highly influenced by the accumulated years of his experience in web technology. Apart from his work and the writing of this book, David Thomas likes to write music, sing his own songs, and accompany them on piano and guitar. Other hobbies of his are going on holidays, reading books, walking, swimming, making tea, and taking trains. Furthermore, he is a firm believer in vegetarianism and the responsibility of each human being for her or his well-being and surroundings—in short, of acting locally while thinking globally. Regarding this book he hopes it will be of great value to many people to enjoy an effective and efficient use of Trinidad. I would like to thank my wife for her patience during the writing of this book. Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 About the Reviewers Cagatay Civici is the PMC member of open source JSF implementation Apache MyFaces and the project lead of popular PrimeFaces framework. In addition to being a recognized speaker in international conferences such as JSFSummit, JSFDays, and local events, he's an author and technical reviewer of books regarding web application development with Java and JSF. Cagatay is currently working as a consultant and instructor in the UK. Simon Lessard has been using Java since 2000 with a focus first on game server development, and since 2005 on Web development, when he joined Fujitsu Canada team. Since then, he joined the Apache community working mainly on Apache Trinidad and Apache MyFaces 2.0, and also represents Fujitsu Limited on the JSF 2.0 Expert Group. Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Table of Contents Preface 1 Chapter 1: Introducing Trinidad 7 Background 7 Overview of Trinidad 9 Characteristics of Trinidad 9 General key criteria for the choosing of Trinidad 10 Seamidad! Ease JSF development with Seam 13 Introduction and overview of Seam 13 Application of Seam with Trinidad 14 Seam conversations and other context management 16 Seam navigation 17 Seam authorization 18 Configuring Trinidad 24 Summary 28 Chapter 2: Structuring and Building Pages with Facelets 29 Facelet page composition—templating with Facelets 30 Using the template 34 Facelet composition components 36 Creating the composition component 37 The model attribute 38 The visible attribute 39 The msgLabel attribute 39 The labelStyle attribute 40 The required attribute 40 The readOnly attribute 41 The width attribute 41 The margin attribute 41 Declaring the composition component 42 Applying the composition component 43 Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Table of Contents Using JSTL for further refinement 45 Typical JSTL structures 45 Things to be aware of when using JSTL and Facelets 47 Other tags to be aware of 48 Experiencing Facelets in real life projects 48 Summary 49 Chapter 3: Most Wanted Tags and Tag Attributes 51 Component library structure 51 Trinidad’s XHTML tag library namespace (trh) 53 Trinidad’s core tag library namespace (tr) 54 Standard tag attributes 57 Standard tag attributes in tag groups 58 Attributes that occur in form and display tags 58 Attributes that occur in command and navigation components 60 Attributes that occur in large input and output components 60 The tag attributes for table, treeTable, and tree 61 The tag attributes for table and treeTable 61 The tag attributes for tree and treeTable 62 The tag attributes for treeTable 63 The tag attributes for tree 63 Summary 63 Chapter 4: Rendering Pages Partially 65 Tag-based PPR 66 Finding the trigger 67 Aspect 1: Ensure that the ID of the PPR trigger is correct 68 Aspect 2: Ensure that the Trinidad configuration is correct 68 Aspect 3: Ensure that the refreshed fields are reset 69 Aspect 4: Ensure proper MVC setup 69 Aspect 5: Ensure that the tag's partialTriggers work 70 Aspect 6: Beware of using PPR with the rendered attribute 70 PPR with server-side caching by means of the Trinidad pageFlowScope 70 PPR with a tr:selectOneChoice to refresh itself inside a component 71 PPR with a tr:selectOneChoice component and a valueChangeListener 73 PPR with a tr:selectOneChoice component and an actionListener 76 PPR and the rendered attribute 79 Applying PPR naively 79 The right way—a parent component with partial trigger 81 Java-side PPR using Trinidad's RequestContext 82 Application of PPR from the Java-side 83 Step I: Define the PPR source 84 Step II: Add the partial target 84 Summary 85 [ ii ] Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Table of Contents Chapter 5: Web Application Groundwork 87 Navigation 87 Trinidad's Dialog Framework 90 Programmatically creating a dialog 91 Providing the data flow from dialog to dialog 91 Returning from a dialog 92 Authorization 93 Equipping each XHTML with authorization 93 User authorization 94 Internationalization (I18n) 95 I18n on single labels 95 I18n on internal Facelet composition components 95 Polling 96 Setting up the application with Seam-gen 97 Setting up an Eclipse project using Seam-gen 99 Deployment 101 Trinidad-specific and Facelet-related changes to the project files 102 Trinidad-specific changes to the Ant build script 105 Deployment from Eclipse 106 Browser client setup 109 Summary 111 Chapter 6: Building a Panel-based Content 113 Where the Trinidad panel components live and what they support 113 The accordion and showDetailItem components 115 How to play the panelAccordion 115 The showDetailItem component—press to play an accordion key 116 The combination of accordion and showDetailItem 120 An alternative to pure Facelets 122 The content panel—same soul, different incarnation 123 ControllerPanel keeps the panels under the same roof 124 The toolbar facet 125 Skinning the panels 128 Skinning the accordion and its children 128 Skinning specific properties of the accordion's children 130 Switching the skins on configuration level 130 Summary 132 Chapter 7: Building a Form 133 Building a form 134 Step I: Building the composition components 135 The fieldText component 135 [ iii ] Download at WoweBook.Com This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104

Description:
The book is a hands-on practical guide that stresses the discussion of code and builds up a sample application that illustrates all the standard UI types covered by Trinidad. This book is written for Java developers who are beginners at JSF and experienced web developers who are looking for an intro
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.