<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}"/>
<apex:commandButton action="{!save}" value="save"/></apex:pageblock>
</apex:form>
</apex:page>
/* Apex class*/
public class MyController {
private final Account account;
public MyController() {
account = [SELECT Id, Name, Site FROM Account
WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
}
public Account getAccount() {
return account;
}
public PageReference save() {
update account;
return null;
}
}
Unable to insert account name.any solution to get rid from below error:
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!save}' in component <apex:page> in page fresh14
任何人都可以提出最佳解决方案。主要问题在于公共 PageReference save() 代码的“插入”选项
任何人都可以使用插入代码
或者
插入和更新代码的组合。