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
rao venkyrao venky 

Sample code....

Hai Everyone,

I wirtten sample VFpage code. It shows error "System.LimitException: Maximum stack depth reached: 1001 ".Can any please Explain this One?
    <apex:page controller="AccountWizardController" tabStyle="Account">
  <apex:sectionHeader title="Account Wizard" subtitle="Step 1 of 3"/>
  <apex:form >
    <apex:pageBlock >
     </apex:pageBlock>
  </apex:form>
</apex:page>
Class: public with sharing class AccountWizardController 
{
  Public Account acc{get; set;}
 Public AccountwizardController()
 {
  Account acc=new account();
  }
}
shashi lad 4shashi lad 4
According to the documentation, this happens when any Apex invocation that recursively fires triggers due to dml statements is 16. 
But in your case i don't see any dml statements and i copied this code and worked fine for me. You want to try in different environment or may be want to clear the cache ( don't know why?) in the browser. its weird... 

- shashi
William TranWilliam Tran
Your are defining the variable acc twice, try this:
 
public with sharing class AccountWizardController 
{
  Public Account acc{get; set;}
 Public AccountwizardController()
 {
  acc=new account();
  }
}

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

Thanks