Monday, June 29, 2015

How to set common styleClass when component is required, readonly or disabled

This is to show how to highlight input components globally when it is either required, readonly, or disabled.

1. Create a class that is extending the javax.faces.application.ViewHandlerWrapper.
public class MyViewHandlerWrapper extends ViewHandlerWrapper {


2. Overrider the renderView method.
public void renderView(FacesContext fc, UIViewRoot view) throws IOException, FacesException {

  super.renderView(fc, view);


3. create a private method to find input components recursively and highlight them based on the required, readonly and disabled attribute.


Related Posts Plugin for WordPress, Blogger...