Salesforce 使用apex代码保存数据后无法清除文件
因为帐户值在视图状态下仍然可用。 在pagereference方法中添加另一行,这应该会有所帮助。大概是这样的:Salesforce 使用apex代码保存数据后无法清除文件,salesforce,apex-code,Salesforce,Apex Code,因为帐户值在视图状态下仍然可用。 在pagereference方法中添加另一行,这应该会有所帮助。大概是这样的: //Apex Class public class MyController { private Account account; public Account getAccount(){ if(account == null) account=new Account(); return account; } public Pag
//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?
我看不出有什么问题。但是,您是否尝试使用apex:commandButton的重新渲染器属性?
//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?
public PageReference save(){
insert account;
account=null;
return null;
}