You need to sign in to do that
Don't have an account?
new_bie
apexpages.message statements?
Hi
i am confused to below statement, can you explain the staments.
Apexpages.addMessge(new apexpages.message(apexpages.severity.info,'error message'))
Apexpages.message mymsg=new Apexpages.message(apexpages.severity, summary, detail);
how many ways create a object in apex?
Regards..
Hi,
No need confuse its very easy.
Apexpages.message mymsg=new Apexpages.message(apexpages.severity, summarydetail);
From the above line just you are creating intance for 'Apexpages.message' with value . here 'summarydetail' is value
for severity under apexpages.
if you want to display this message on the page the you need to use 'addMessge' like below line
ApexPages.addmessage(mymsg);
then only the above message will display on visualforcepage. for more info for ApexPages methods click here
insteed of writting two line of code we will make it simple like below line.
Apexpages.addMessge(new apexpages.message(apexpages.severity.info,'error message'))
All Answers
Hi,
No need confuse its very easy.
Apexpages.message mymsg=new Apexpages.message(apexpages.severity, summarydetail);
From the above line just you are creating intance for 'Apexpages.message' with value . here 'summarydetail' is value
for severity under apexpages.
if you want to display this message on the page the you need to use 'addMessge' like below line
ApexPages.addmessage(mymsg);
then only the above message will display on visualforcepage. for more info for ApexPages methods click here
insteed of writting two line of code we will make it simple like below line.
Apexpages.addMessge(new apexpages.message(apexpages.severity.info,'error message'))
thanks for immediate response.
How many ways create instance in apex.
Regards.
Hi,
Only one way to create the instance in apex by using 'new' key word.
if you look at below two line
Apexpages.addMessge(new apexpages.message(apexpages.severity.info,'error message'))
Apexpages.message mymsg=new Apexpages.message(apexpages.severity, summary, detail);
In the first line you are creating instance by using 'new ' keyword but you didn't assign to any variable
but in the second line you are assigning to 'mymsg' Apexpages.message variable.
only this is the bifference but the way of creation is same.
So, you can get to know there is only one way to create the instance .
Thanks for your valuable information.
Regards