You need to sign in to do that
Don't have an account?
newbiewvfdev
How do you pass parameters from one page to another page?
Hi there,
I have a page, where I am displaying a record(i.e Job). There are two buttons on the page. One is 'Copy Job' and 'Edit Job'. When a user clicks 'Copy Job', I have an action method on the custom controller called copyJob and I am copying the existing Job. Now I need to pass this job object to another page, which has a different controller. How can I pass an object (i.e Job) from one page's controller to another page? Thank You.
You need to add the object id to the request.
Presumably your action method is returning a pagereference?
In which case, you need something like the following:
PageReference pr=Page.MyPage;
pr.getParameters().put('id', <the new object id>);
return pr;
This assumes you are using a standard controller plus extensions, or are picking up the object id in a custom controller.
All Answers
You need to add the object id to the request.
Presumably your action method is returning a pagereference?
In which case, you need something like the following:
PageReference pr=Page.MyPage;
pr.getParameters().put('id', <the new object id>);
return pr;
This assumes you are using a standard controller plus extensions, or are picking up the object id in a custom controller.
Hi,
Does this mean you could only pass an id to another page? You can't pass the object or an object reference to the other page?