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
BHASKAR GANGULYBHASKAR GANGULY 

Apex PageReference clarification

HI,
I am new to Apex Programing.
I am trying to create a simple program using Visualforce where i am inserting Account data.I want to nevigate to the newly created Account Record by click on Save Button.But its not working.
Can some bosy help me here.
My VisualForce code : 
<apex:page controller="TDname" sidebar="false">
<apex:form >
<apex:outputLabel >Account Name :</apex:outputLabel>
<apex:inputText value="{!Accname}"/>
<apex:commandButton value="Save" action="{!AccSave}"/>
</apex:form>
</apex:page>

My Apex Class :

public class TDname {

public string Accname{Set;Get;}

public void AccSave()
{
 Account a = new Account();
 a.name = Accname;
 Insert a;
}
Public PageReference save()
{
PageReference acctPage = new ApexPages.StandardController(account).view();

        acctPage.setRedirect(true);

        return acctPage;

}
}
Best Answer chosen by BHASKAR GANGULY
BHASKAR GANGULYBHASKAR GANGULY
I resolved the problem.