For displaying only the summary for a FacesMessage instance you have two options
- Pass no detail to the FacesMessage constructor
The above options have their problems. Let’s say you don’t know if a FacesMessage will be generated with or without detail information but need to show it if available. You can’t go for option 1, you have to set showDetail=“true”. For this case you have to consider how JSF is displaying FacesMessage instances. Let’s look at the implementation of
1 2 3 4 5 6 7
This means that if you instantiate a FacesMessage with detail set null, JSF will display the summary (i.e you will see the summary text twice). To avoid this instantiate FacesMessage with an empty detail String!