How to navigate to next page on click of a button in Salesforce?

Visualforce page1:

<apex:page controller="Sample">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >            
            <apex:commandButton value="Next Page" onclick="show();"/>

Apex class:

public class Sample {
    public Sample() {
    public PageReference next() {
        return Page.Sample1;

Visualforce page2:

<apex:page >
This is the second page.


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit