function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
visulaforcevisulaforce 

how to pass an object from VF page to apex

I have one VF page and a  controller having a method fatching records using third party API and putting records into a map. in VF page m calling this method as action method and map to display records. this VF page is having a output link transferring control to 2nd VF page.  In  2nd  VF page i wanna to use  same map to display same records and dont want to call the method again cos of method's execution time. my question is how to achieve this because VF provides a way to pass parameters but ther is no way to set attributes like setAttributes for jsp/servlet in java.
BogdanSBogdanS
If I understood right you want to pass objects from one VF page to another. If this is what you want,  I would make a Apex class with a static Map called maybe Cache, and with 2 methods, getter and setter. Having this class with the static map , you can put any object in it even your map and then you can access it from any VF page you like.