Some more notes on JSF
JSF is a rich framework, we will also use it in concert with the object-relational mapping (ORM) technology - JPA (Java Persistence API) later this semester. Let's take a look at some more interesting features it offers. Create a new project in Intellij IDEA, and test the following features of JSF:
- Data table allows producing HTML tables filled with data provided by the backing bean. Study the following example: JSF Datatable example and try to run it, then make some modifications, such as adding table footer, changing the columns, etc.
- Composite components allow creating reusable pieces of HTML pages in a new xhtml namespace that can be configured for each specific use. Test the following example: Composite Components in JSF
- Simple validator. Validating input fields in forms can be done in various ways in JSF - either with attributes such as maxlength built-in validators <f:validateXXX>, or even using javascript code called from onclick attribute of <h:commandLink, or multiple field validators. First, test this validateLength example. Try some other simple validators, see for example this bit older javadoc for facelets - select f: in the upper-left frame, and check the f:validateXXX tags.
- Look at this Custom validator example
- Now let's have a look at two examples of Multiple Components Validators in JSF
- Some more interesting examples: JSF PreRenderViewEvent example, JSF PostConstructApplicationEvent and PreDestroyApplicationEvent examples, then various ways how to pass values from JSF page to backing bean, or setPropertyActionListener example, maybe useful for us: internationalization example, or value change listener, or .
- JSF extensions. There are several extensions/replacements for JSF, such as PrimeFaces, BootsFaces, ButterFaces, or utility library OmniFaces. In practical applications, developers often use them as they provide useful practical high-level components. Make yourself informed about them.