+ Start a Discussion

How can I change the page by clicking the save button

How can I change the result page when i click on the save button.?


thank you


<apex:commandButton action="{!myZeiterfassungsListeController.save}" value="Save" />



use page reference in your visual force page.


Hi Daniel,


Your 'save'  which you're referring here should be a pageReference method. This will automatically redirect it to the reference you return in the method.





public pageReference goToHome()


     return new PageReference('/home/home.jsp');



calling this method as action on your button will redirect you to the Home Page.


I have tried a lot of things, like the following code. It's not working


It changes always on the same default page.


public Pagereference goHome(){
	Pagereference to = Apexpages.currentPage();
	return to;


public Pagereference goHome(){
	Pagereference to = new Pagereference('/apex/mypage?user=guest');	return to;

<apex:commandButton value="Save"  action="{!goHome}" />


When I try it with an empty linked commandButton like this, it's changing the page to the default page too. Thats crazy. Any solution?

<apex:commandButton value="Save"  />