0
//Apex page
 <apex:page controller="MyController" tabStyle="Account"  showChat="false" >
    <apex:form >
        <apex:pageBlock title="Congratulations  {!$User.FirstName}">
            You belong to Account Name: <apex:inputField value="{!account.name}"/>
          Annual Revenue:  <apex:inputField value="{!account.AnnualRevenue}" required="true"/>
           <apex:commandButton action="{!save}" value="save"/></apex:pageblock>
    </apex:form>
</apex:page>

私のコードはデータをアカウントに正常に保存していますが、更新ボタンを押すまでフィールドはクリアされません

//Apex Class

public class MyController {


    private Account account; public Account getAccount(){
    if(account == null)
    account=new Account();
    return account;
    }
    public PageReference save(){
    insert account;
    return null;
    }
}

My code is saving the data to my account successfully.But,the fields are not clearing until i press refresh button. 

So, anyone can guide me to clear the page after saving my data?
4

1 に答える 1