Using the PageReference class can be extremely useful when needing to call apex methods on a visualforce page. It’s important to know that you can do a variety of things like updating,inserting,deleting records but lets cover the basics here.
This is how you would do a page redirect:
1 2 3 4 5 6 7 8 |
public class salesforcenick_Controller { public PageReference save() { PageReference pgref = new PageReference('http://www.google.com'); pgref.setRedirect(true); return pgref; } } |