-3

I have two VF pages and I want to pass one parameter from one VF page and get that parameter on another VF page through controller so,what should I do and also how to use POST Method for this purpose??

2
  • 2
    did you already try something ? May 19, 2014 at 15:14
  • I tried this in VF like setting parameter using <apex:param> tagg & getting that value in apex using string passedParam1 = Apexpages.currentPage().getParameters().get('myParam'); , but still its not working..
    – Sumrock74
    May 20, 2014 at 11:13

2 Answers 2

5

You can simply pass the parameters through the URL.

say you are redirecting from one VF page to another

string value = 'your param value';
string url;
url = '/apex/VF_Page_Name?param1=' + value; 

PageReference pageRef = new PageReference(url);
pageRef.setRedirect(true);
return pageRef;

Then in the controller of the VF page, you just can get the param like this

String param_value = system.CurrentPageReference.GetParameters().get('param1');
1
3

You can try this:

PageReference page = Page.secondPage;

page.getParameters().put('REPLEACE FOR KEY', 'REPLACE FOR VALUE');

return page;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .