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. Partial Rendering .............................................................................................. 31 5.4. RichFaces Integral Parts ................................................................................... 31 5.5. Limitations and Rules ........................................................................................ 32 5.6. Ajax Request Optimization ................................................................................. 32 5.6.1. Re-Rendering ......................................................................................... 32 5.6.2. Queue and Traffic Flood Protection ......................................................... 34 5.6.3. Queue Principles .................................................................................... 35 5.6.4. Data Processing Options ........................................................................ 41 5.6.5. Action and Navigation ............................................................................. 42 5.6.6. JavaScript Interactions ............................................................................ 42 5.6.7. Iteration components Ajax attributes ........................................................ 44 5.6.8. Other useful attributes ............................................................................ 44 5.6.9. Common Ajax Attributes ......................................................................... 45 5.7. How To... ......................................................................................................... 55 5.7.1. Send an Ajax request ............................................................................. 55 5.7.2. Decide What to Send ............................................................................. 56 iii RichFaces Developer Guide 5.7.3. Decide What to Change ......................................................................... 56 5.7.4. Decide what to process .......................................................................... 56 5.8. Filter Configuration ............................................................................................ 57 5.9. Scripts and Styles Load Strategy ....................................................................... 59 5.10. Request Errors and Session Expiration Handling ............................................... 60 5.10.1. Request Errors Handling ....................................................................... 61 5.10.2. Session Expired Handling ..................................................................... 61 5.11. Skinnability ..................................................................................................... 62 5.11.1. Why Skinnability ................................................................................... 62 5.11.2. Using Skinnability ................................................................................. 63 5.11.3. Example ............................................................................................... 63 5.11.4. Skin Parameters Tables in RichFaces .................................................... 64 5.11.5. Creating and Using Your Own Skin File ................................................. 66 5.11.6. Built-in Skinnability in RichFaces ........................................................... 67 5.11.7. Changing skin in runtime ...................................................................... 68 5.11.8. Standard Controls Skinning ................................................................... 70 5.11.9. Client-side Script for Extended Skinning Support .................................... 79 5.11.10. XCSS File Format .............................................................................. 81 5.11.11. Plug-n-Skin ......................................................................................... 82 5.12. Definition of Custom Style Classes ................................................................... 88 5.13. State Manager API .......................................................................................... 90 5.14. Identifying User Roles ..................................................................................... 95 6. The RichFaces Components ........................................................................................ 97 6.1. Ajax Support ..................................................................................................... 97 6.1.1. < a4j:ajaxListener > ............................................................................... 97 6.1.2. < a4j:actionparam > .............................................................................. 99 6.1.3. < a4j:form > ........................................................................................ 101 6.1.4. < a4j:region > ..................................................................................... 103 6.1.5. < a4j:support > .................................................................................... 106 6.1.6. < a4j:commandButton > ....................................................................... 109 6.1.7. < a4j:commandLink > .......................................................................... 112 6.1.8. < a4j:jsFunction > ................................................................................ 114 6.1.9. < a4j:poll > ......................................................................................... 115 6.1.10. < a4j:push > ...................................................................................... 117 6.1.11. < a4j:queue > .................................................................................... 120 6.1.12. < a4j:status > .................................................................................... 123 6.2. Resources/Beans Handling .............................................................................. 125 6.2.1. < a4j:loadBundle > .............................................................................. 125 6.2.2. < a4j:keepAlive > ................................................................................ 129 6.2.3. < a4j:loadScript > ...............................................................................