I am creating custom visualforce pages. I am trying to create a cart. The way I have done it is:

  • Create a VF Page
  • In JS, code a List (I've used scripts)
  • Write methods that add, delete and mod values from a list

I want to be able to call this method from other visualforce pages i.e. from the product pages.

The end goal is for the users to be able to click submit one they have done their product selection from the pages and see everything in the cart.

P.S. If there is anyway that I could do this differently, like create a table within salesforce and populate the data there then I am open to suggestions.

1 Answer 1


You can create a common controller to share the data between two visualforce pages.

Or, otherwise from the first controller's method you can create a PageReference instance of 2nd visualforce page and then redirect to the 2nd page.

You must log in to answer this question.

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