Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Friday, February 18, 2011

Controlling message display style in ADF 11g

On a ADF form bound to a updatable view object, when you hit the submit button after entering data, error messages may come up due to failures like required attribute missing, business logic failure written at EO level etc.

By default these messages comes as a popup on the screen. If you want them to appear on the page itself instead of a popup then there is a property 'inline' in the af:messages component. You can set it to true.

However, there may be a requirement where you want to display the messages as inline if it's just one message and in a popup if more than one. To do that, you can create a request scope managed bean and count the size of iterator FacesContext.getCurrentInstance().getMessages();  Based on the count you can return true or false.

A sample workspace can be found here

3 comments:

Anonymous said...

hi, new to the site, thanks.

Arun said...

Useful Post. It was so easy.
That way the default error message for the component - af:fileDownloadActionListener's error message 'The file was not downloaded or was not downloaded correctly.'

Unknown said...

Useful post, it was easy to change the default error message of
af:fileDownloadActionListener 'The file was not downloaded or was not downloaded correctly.'