My JSF Books/Videos My JSF Tutorials OmniFaces/JSF PPTs
JSF 2.3 Tutorial
JSF Caching Tutorial
JSF Navigation Tutorial
JSF Scopes Tutorial
JSF Page Author Beginner's Guide
OmniFaces 2.3 Tutorial Examples
OmniFaces 2.2 Tutorial Examples
JSF Events Tutorial
OmniFaces Callbacks Usages
JSF State Tutorial
JSF and Design Patterns
JSF 2.3 New Features (2.3-m04)
Introduction to OmniFaces
25+ Reasons to use OmniFaces in JSF
OmniFaces Validators
OmniFaces Converters
JSF Design Patterns
Mastering OmniFaces
Reusable and less-verbose JSF code

My JSF Resources ...

Java EE Guardian
Member of JCG Program
Member MVB DZone
Blog curated on ZEEF
OmniFaces is an utility library for JSF, including PrimeFaces, RichFaces, ICEfaces ...

.

.

.

.

.

.

.

.


[OmniFaces Utilities] - Find the right JSF OmniFaces 2 utilities methods/functions

Search on blog

Petition by Java EE Guardians

Twitter

joi, 5 februarie 2015

See 10 Reasons to Use OmniFaces 2.0

Below you have 10 reasons to use OmniFaces 2.0 in your JSF projects

1. Your application is ready and works like a charm, but ViewExpiredException spoil all the satisfaction ? Well, any JSF developer saw this exception and everybody wants to solve it in a fast and elegant approach. OmniFaces fix this problem via a custom tag handler that instructs the view handler to recreate the entire view whenever the view has been expired. So, check how easy is to get rid of this exception using OmniFaces <o:enableRestorableView>.

2. Most probably, you are loading external resources (e.g. CSS, JS, images) in a classic JSF style by pointing the /resources folder libraries. But, you want to use <h:outputScript> and <h:outputStylesheet> to load external resources from CDNs (e.g. Google Hosted Libraries), which, by default, is not possible in JSF ? OmniFaces comes with the solution via a custom resource handler, named CDNResourceHandler. This will simply allows you to load resources from CDNs via <h:outputScript> and <h:outputStylesheet>. Moreover, check out CombinedResourceHandler and UnmappedResourceHandler, to discover more useful stuff.

3. You need to render images that comes as InputStream or byte[] ? You want to render them as data URI ? Obviously, the <h:graphicImage>  cannot help you to find the answer to these questions. But, OmniFaces provides the <o:graphicImage>, which is an extension of the <h:graphicImage>  dedicated to render JSF resource as data URI, InputStream/byte[] property as resource, InputStream/byte[] property as data URI, etc. Just check the OmniFaces ShowCase.

4. JSF custom converters is a well-known topic to JSF developers. We need to write them in many kind of situations, and sometimes they are time consuming, they are called at every request regardless of whether the submitted value has changed or not, or they need to do the job based on possibly expensive service/DAO operations, etc. Just if you read the names of converters provides out of the box by OmniFaces, you will take into account to check them at your first need to write a custom converter: GenericEnumConverter, ListConverter, ListIndexConverter, SelectItemsConverter, SelectItemsIndexConverter, ValueChangeConverter.

5. Is time to validate your form, so you start writing your custom validators and attach them to components. Suddenly, you realize that your components validation is interdependent, which requires special custom validators. Well, what exactly are you looking for? to validate if ONLY ONE of the given UIInput components have been filled out ? validate if ALL of the given UIInput components have been filled out ? validate if ALL of the given UIInput components have the same value ? validate if ONLY ONE of the given UIInput components has been filled out or that NONE of the given UIInput components have been filled out ? etc. If you answered yes, or you think of some other case, then OmniFaces has a set of 14 special custom validators.

6. When you checked your page source code, you've noticed quite a lot of markup ? Most of this markup is loaded (rendered) at each postback even if you don't change it (e.g. large tables with fix data). Well, the Render Response phase is the most time consuming JSF phase, especially in cases when the rendered markup is consistent. You can speed up this process with a snap of a finger via the OmniFaces Cache component. Caching markup will boost the Render Response phase (check some tests here). The examples provided by OmniFaces Showcase are very clear and well explained.

7. I know a trendy topic: deferred scripts. I'm pretty sure that you heard about placing the scripts at the end of </body>, use defer="true" or async="true", but I'm not so sure that you know that these approaches are not really working as expected. The OmniFaces, <o:deferredScript> defers the loading of the given script resource to the window load event (the given script resource is only loaded when the window is really finished with loading).

8. By default, most of AJAX exceptions are invisible to the client. They are returned to the client, but unfortunately JSF AJAX clients aren't prepared to deal with arbitrary error messages, so they simply ignore them. But a custom exception handler is specially created for this task by OmniFaces (it works for AJAX and non-AJAX exceptions). The handler is named FullAjaxExceptionHandler, and the factory is named FullAjaxExceptionHandlerFactory. This will give to your AJAX based applications a real boost, because your end users would know if their actions was successfully performed or not.

9. Beside validation messages, you simply want to highlight the invalid inputs of a form via some CSS ? The OmniFaces<o:highlight> is a helper component which highlights all invalid UIInput components and the associated labels by adding an error style class to them. Additionally, it by default focuses the first invalid UIInput component. Check the OmniFaces ShowCase to see how easy is to use it.

10. Working with <h:message> and <h:messages> has several important limitations. OmniFaces, comes with <o:messages>, which allows us to specify multiple client IDs space separated in the for attribute, show a single custom message whenever the component has received any faces message, HTML escaping and messages iteration markup control.

P.S. Obviously, if you read so far, and you accessed the OmniFaces ShowCase at least once, then you noticed that there are many other interesting components, handlers, listeners, functions, utils etc. There is plenty material to make "1000 Reasons to Use OmniFaces 2.0", but, now that you know what OmniFaces can do for your JSF applications, I'm sure that you will dig further and OmniFaces will make your life easier. Do not omit to check the OmniFaces source code, which provides valuable lessons to any JSF developer. There you will find answer to many questions, and a great source of inspiration for your projects.

 If you have specific programming problems or questions related to the OmniFaces library, feel free to post a question on Stack Overflow using at least the jsf and omnifaces tags.

Niciun comentariu :

Trimiteți un comentariu

JSF BOOKS COLLECTION

Postări populare

OmniFaces/JSF Fans

Visitors Starting 4 September 2015

Locations of Site Visitors