show error message in visualforce

Many times it is required to show warning,error or information messages on a visualforce page so as to indicate to the user. For these, salesforce provides page message,pagemessages,message and messages components.
We have to create a new instance of the message in apex and make sure we have placed the messages component on the visualforce page.
In the below example messages are displayed on button press if any of the input values are not submitted.
Visualforce Page


1 comment:

  1. You r a STAR.
    Thank you so very much, i have also referred your SOSL example page. that worked like a charm. THank youu :)