Success or failure messages are not being displayed contact page magento

Try by replacing

<?php getLayout()->getMessagesBlock()->getGroupedHtml(); ?>

with

<?php

getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton(‘customer/session’)->getMessages(true)); ?>
getLayout()->getMessagesBlock()->getGroupedHtml();

?>