Richfaces Developer Guide
Total Page:16
File Type:pdf, Size:1020Kb
RichFaces Developer Guide RichFaces framework with a huge library of rich components and skinnability support RichFaces Developer Guide 1. Introduction ................................................................................................................... 1 2. Technical Requirements ................................................................................................. 3 2.1. Supported Java Versions .................................................................................... 3 2.2. Supported JavaServer Faces Implementations and Frameworks ............................ 3 2.3. Supported Servers .............................................................................................. 3 2.4. Supported Browsers ............................................................................................ 4 3. Getting Started with RichFaces ...................................................................................... 5 3.1. Downloading the RichFaces ................................................................................ 5 3.2. Simple JSF application with RichFaces ................................................................ 5 3.2.1. Adding RichFaces libraries into the project ................................................ 5 3.2.2. Registering RichFaces in web.xml ............................................................. 6 3.2.3. Managed bean ......................................................................................... 8 3.2.4. Registering bean in faces-cofig.xml ........................................................... 8 3.2.5. RichFaces Greeter index.jsp ..................................................................... 9 3.3. Integration of RichFaces into Maven Project ....................................................... 10 3.4. Relevant Resources Links ................................................................................. 16 4. Settings for different environments ................................................................................ 17 4.1. Web Application Descriptor Parameters .............................................................. 17 4.2. Sun JSF RI ...................................................................................................... 20 4.3. Apache MyFaces .............................................................................................. 20 4.4. Facelets Support ............................................................................................... 21 4.5. JBoss Seam Support ........................................................................................ 21 4.6. Portlet Support .................................................................................................. 25 4.7. Sybase EAServer .............................................................................................. 25 4.8. Oracle AS/OC4J ............................................................................................... 25 5. Basic concepts of the RichFaces Framework ................................................................ 27 5.1. Introduction ....................................................................................................... 27 5.2. RichFaces Architecture Overview ....................................................................... 28 5.3. RichFaces Integral Parts ................................................................................... 31 5.4. Limitations and Rules ........................................................................................ 32 5.5. Ajax Request Optimization ................................................................................. 32 5.5.1. Re-Rendering ......................................................................................... 32 5.5.2. Queue and Traffic Flood Protection ......................................................... 35 5.5.3. Queue Principles .................................................................................... 36 5.5.4. Data Processing Options ........................................................................ 41 5.5.5. Action and Navigation ............................................................................. 42 5.5.6. JavaScript Interactions ............................................................................ 42 5.5.7. Iteration components Ajax attributes ........................................................ 44 5.5.8. Other useful attributes ............................................................................ 44 5.6. How To... ......................................................................................................... 45 5.6.1. Send an Ajax request ............................................................................. 45 5.6.2. Decide What to Send ............................................................................. 46 5.6.3. Decide What to Change ......................................................................... 46 5.6.4. Decide what to process .......................................................................... 47 iii RichFaces Developer Guide 5.7. Filter Configuration ............................................................................................ 47 5.8. Scripts and Styles Load Strategy ....................................................................... 49 5.9. Request Errors and Session Expiration Handling ................................................ 51 5.9.1. Request Errors Handling ......................................................................... 51 5.9.2. Session Expired Handling ....................................................................... 51 5.10. Skinnability ..................................................................................................... 52 5.10.1. Why Skinnability ................................................................................... 52 5.10.2. Using Skinnability ................................................................................. 53 5.10.3. Example ............................................................................................... 54 5.10.4. Skin Parameters Tables in RichFaces .................................................... 55 5.10.5. Creating and Using Your Own Skin File ................................................. 56 5.10.6. Built-in Skinnability in RichFaces ........................................................... 57 5.10.7. Changing skin in runtime ...................................................................... 58 5.10.8. Standard Controls Skinning ................................................................... 60 5.10.9. Client-side Script for Extended Skinning Support .................................... 70 5.10.10. XCSS File Format .............................................................................. 71 5.10.11. Plug-n-Skin ......................................................................................... 72 5.11. Definition of Custom Style Classes ................................................................... 79 5.12. State Manager API .......................................................................................... 81 5.13. Identifying User Roles ..................................................................................... 86 6. The RichFaces Components ........................................................................................ 87 6.1. Ajax Support ..................................................................................................... 87 6.1.1. < a4j:ajaxListener > ............................................................................... 87 6.1.2. < a4j:actionparam > .............................................................................. 89 6.1.3. < a4j:form > .......................................................................................... 90 6.1.4. < a4j:region > ....................................................................................... 91 6.1.5. < a4j:support > ..................................................................................... 94 6.1.6. < a4j:commandButton > ......................................................................... 98 6.1.7. < a4j:commandLink > .......................................................................... 101 6.1.8. < a4j:jsFunction > ................................................................................ 102 6.1.9. < a4j:poll > ......................................................................................... 104 6.1.10. < a4j:push > ...................................................................................... 106 6.1.11. < a4j:queue > .................................................................................... 108 6.1.12. < a4j:status > .................................................................................... 112 6.2. Resources/Beans Handling .............................................................................. 114 6.2.1. < a4j:loadBundle > .............................................................................. 114 6.2.2. < a4j:keepAlive > ................................................................................ 118 6.2.3. < a4j:loadScript > ................................................................................ 119 6.2.4. < a4j:loadStyle > ................................................................................. 120 6.3. Ajax Validators ...............................................................................................