There are times when you want to display a message in the message bar that goes across the page when not doing a redirect in your controller. Normally status messages are set when redirecting using the setRedirect() method.
You can set the message bar to display within the view layout itself by directly accessing the message queue with JApplication::enqueueMessage();
This will display a blue or green message status bar across the page as long as you have the message module tag in your template index.php file.
$app = &JFactory::getApplication(); $app->enqueueMessage("File was submitted successfully!");
This will display a red error status bar with your error message:
$app = &JFactory::getApplication(); $app->enqueueMessage("Error encountered. File not Submitted!","error");