You need to sign in to do that
Don't have an account?

Error message not appear in VF page
Good day,
I would like to create a VF page as a error page receiver mainly for exception, with the simple code below, i do not know why the error come from controller doesn't appear in following Vf page
<apex:page showHeader="true" standardStylesheets="true" tabStyle="Account" id="thePage" > <apex:form > <apex:pageBlock > <apex:pageMessages /> </apex:pageBlock> </apex:form> </apex:page>
My controller have something like below
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'this is error'); ApexPages.addMessage(myMsg); if(StringUtils.isBlank(URL)){ URL = '/apex/myErrorPAge'; } PageReference pageRef = new PageReference(URL); pageRef.setRedirect(true); return pageRef;
But i can't figure out why the error message doesn't show in VF page ?
Question :
1. in VF page, i do not put controller, so that it can be used as general exception page, can i do that ?
2. Even i have put the controller in VF page, but it still not able to show me message, not sure what i have miss out
Thanks in advance !
I would suggest you to do the following.
Hope that helps.
Afzal
Thanks Yo Afzal !
So we expecting error show in URL ? do we have chance to avoid the error msg show in URL string ?
If you want to pass information from one page to another they must either share the same controller or pass through query parameters.
And if you want to pass via the controller state you must NOT use setDirect(true), which will realod and hence discard any view state.
I can't pass in something like below ? I get null value :( ..any chance to declare session like java ?
ApexPages.currentPage().getParameters().put('errorStr', 'this is error msg');
You are trying to add a parameter to current page, which is not going to work.
Suppose you are redirecting user from page1 to page2 (error page). Then in your page1's controller you will have something like this.
Hope that helps.
Afzal