Creating Custom Severity Messages in JSF

I am using JSF messages to display error / warning / info messages in my web application. I also use <p:messages> to display them in a browser with different styles.

However, I need to create a new style for some of my posts, keeping the rest as it is now. In other words, I need to create ok severity for my JSF messages that will display information in a green tick field.

Although I studied library classes, it seems that this is not a direct way to achieve this. FacesMessages$Severity are stored in the FacesMessages$Severity class as an enumeration and have a private constructor. Do I need to override the source code directly?

+7
source share
1 answer

This is not possible without hacking the JSF API / impl, no.

Just reiterate the seriousness of INFO or abuse something that you don't seem to be using: FATAL . Or, if the functional requirement is purely presentational, run some JS / jQuery / CSS to achieve it.

A sharp alternative would be to rethink the JSF messaging system with custom message wrappers and custom message components.

+3
source

All Articles