This is roughly the same question as in here, I can't comment so I'm re-asking.
My problem is that if the redirect is created in the method assigned to apex:page action attribute, the messages are still lost. I.e.
page 1:
<apex:page controller="aaTest" action="{!processtempcon}">
<apex:form>
<apex:commandButton action="{!processtempcon}" value="Reload"/>
</apex:form>
</apex:page>
page 2 (helloworld2):
<apex:page controller="aaTest">
<apex:messages />
<apex:outputText value="{!myint}" />
</apex:page>
controller (aaTest):
public with sharing class aaTest{
public Integer myInt { get; set; }
public aaTest(){ myInt = 4; }
public pagereference processtempcon(){
pagereference p = page.helloworld2;
apexpages.Message msg =
new Apexpages.Message(ApexPages.Severity.Info,'Total Number of reloads: ' + (myInt++));
apexpages.addmessage(msg);
return p;
}
}
So when I open the first page, it is correctly redirected to page 2 and the output is just "5". If I remove an action attribute in the first page and click a button, I would see a message as well as "5".
What am I missing?
Cheers
looks like nobody knows the answer
apex:pageMessages
here notapex:messages
. You also use 'redirect' in your problem description but nowhere is there asetRedirect(true)
.