I just used the below code in my application but the page message not show. What i doing wrong
VF Page:
<apex:pageMessages id="msgs"/>
<apex:pageBlock >
<apex:outputpanel id="outid" >
<div id="divId">
<apex:pageBlockTable value="{!SomeList}" var="k" >
<apex:column headerValue="COl 1">
<a href="javascript:if (window.confirm('Are you sure?'))CallMethod('{!k.Id}');" >Del</a>
</apex:column>
etc.,
Apex:
public PageReference CallMethod()
{
try{
//my insert code
}catch(System.DMLException e) {
apexpages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Fake Error');
apexpages.addmessage(msg);
return Page.MyPageName;
}
return null;
}
I think some render problem. Because if i am removing the try catch, i got the exception error in the page.