我在VF页面中有一个输入字段,从中输入值。我用get;set;
创建了对象的引用,我想在控制器的save方法中使用该值在对象中插入一个条目。但这是在尝试取消引用空对象错误。
我尝试使用get;set
创建引用,并插入控制器方法中。
Vf页面
<apex:pageBlockSection id="listdiv" columns="1">
<apex:pageBlockSectionItem id="listdivItem">
<apex:outputLabel value="List Name:"></apex:outputLabel>
<apex:inputField value="{!listViewObj.Name}" `enter code here`id="listName" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" />
</apex:pageBlockSectionItem>
<!-- <apex:pageBlockSectionItem id="IsGlobal" rendered="{!isSysAdmin}"> -->
<apex:pageBlockSectionItem id="IsGlobal" >
<apex:outputLabel value="Available to all?:"></apex:outputLabel>
<apex:inputField value="{!listViewObj.akritiv__Is_Global__c}" id="global"
styleclass="slds-input slds-input slds-small-size--1-of-5" style="width:1.25rem;" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem />
<apex:pageBlockSectionItem />
</apex:pageBlockSection>
<apex:outputPanel id="filterCriteria">
<b><apex:outputLabel value="Filter Criteria :"></apex:outputLabel></b>
<br/>
<br/>
</apex:outputPanel>
<apex:outputPanel id="filter1outputpanel1">
<b> <apex:outputLabel value="Filter"></apex:outputLabel></b>
<apex:selectList value="{!selectedFilterfield1}" multiselect="false"
size="1" onchange="getTypeOfSelectedFilter1();startProcess();"
styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" >
<apex:selectOptions value="{!fieldNames}" />
</apex:selectList>
<apex:selectList value="{!selectedFilterOp1}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!Operators}" />
</apex:selectList>
<apex:inputText value="{!filterValue1}" id="filtervalue1" rendered="true" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" />
<apex:selectList value="{!selectCondition1}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-8" >
<apex:selectOptions value="{!condition}" />
</apex:selectList>
</apex:outputPanel>
<br></br>
<br></br>
<apex:outputPanel id="filter1outputpanel2">
<b> <apex:outputLabel value="Filter"></apex:outputLabel></b>
<apex:selectList value="{!selectedFilterfield2}" multiselect="false"
size="1" onchange="getTypeOfSelectedFilter2();startProcess();"
styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" >
<apex:selectOptions value="{!fieldNames}" />
</apex:selectList>
<apex:selectList value="{!selectedFilterOp2}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" >
<apex:selectOptions value="{!Operators}" />
</apex:selectList>
<apex:inputText value="{!filterValue2}" id="filtervalue2" rendered="true" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" />
<apex:selectList value="{!selectCondition2}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-8">
<apex:selectOptions value="{!condition}" />
</apex:selectList>
</apex:outputPanel>
<br></br>
<br></br>
<apex:outputPanel id="filter1outputpanel3">
<b> <apex:outputLabel value="Filter"></apex:outputLabel></b>
<apex:selectList value="{!selectedFilterfield3}" multiselect="false"
size="1" onchange="getTypeOfSelectedFilter3();startProcess();"
styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!fieldNames}" />
</apex:selectList>
<apex:selectList value="{!selectedFilterOp3}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!Operators}" />
</apex:selectList>
<apex:inputText value="{!filterValue3}" id="filtervalue3" rendered="true"
styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5"/>
<apex:selectList value="{!selectCondition3}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-8">
<apex:selectOptions value="{!condition}" />
</apex:selectList>
</apex:outputPanel>
<br></br>
<br></br>
<apex:outputPanel id="filter1outputpanel4">
<b> <apex:outputLabel value="Filter"></apex:outputLabel></b>
<apex:selectList value="{!selectedFilterfield4}" multiselect="false"
size="1" onchange="getTypeOfSelectedFilter4();startProcess();"
styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!fieldNames}" />
</apex:selectList>
<apex:selectList value="{!selectedFilterOp4}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!Operators}" />
</apex:selectList>
<apex:inputText value="{!filterValue4}" id="filtervalue4" rendered="true" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5"/>
<apex:selectList value="{!selectCondition4}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-8">
<apex:selectOptions value="{!condition}" />
</apex:selectList>
</apex:outputPanel>
<br></br>
<br></br>
<apex:outputPanel id="filter1outputpanel5">
<b> <apex:outputLabel value="Filter"></apex:outputLabel></b>
<apex:selectList value="{!selectedFilterfield5}" multiselect="false"
size="1" onchange="getTypeOfSelectedFilter5();startProcess();" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5" >
<apex:selectOptions value="{!fieldNames}" />
</apex:selectList>
<apex:selectList value="{!selectedFilterOp5}" multiselect="false"
size="1" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5">
<apex:selectOptions value="{!Operators}" />
</apex:selectList>
<apex:inputText value="{!filterValue5}" id="filtervalue5" rendered="true" styleclass="slds-form-element__control slds-select_container slds-select slds-small-size--1-of-5"/>
</apex:outputPanel>
<div class="slds-m-vertical--medium"></div>
<br></br>
<apex:outputPanel id="olinkCustomExport">
<table>
<tr>
<td><label> </label></td>
<td> <apex:commandButton value="Save & List View" action="{!save}" styleclass="slds-button slds-button--neutral" />
<apex:commandButton value="Cancel" action="{!save}" styleclass="slds-button slds-button--neutral" /></td>
</tr>
</table>
</apex:outputPanel>
<div class="slds-m-vertical--medium"></div>
</apex:form>
</apex:pageBlock>
</div>
</html>
</apex:page>
public class transactionlistviewgeneratorExtension{
public akritiv__Custom_List_View__c listViewObj {get;set;}
public transactionlistviewgeneratorExtension(ApexPages.StandardController st){
this.acc= (Account) st.getRecord();
accid = (String) st.getRecord().Id;
}
public PageReference save(){
system.debug('Name====='+listViewObj.Name);
String filCrit = '';
akritiv__Custom_List_View__c insertListView = new akritiv__Custom_List_View__c();
insertListView.Name = listViewObj.Name;
insertListView.akritiv__Is_Global__c = listViewObj.akritiv__Is_Global__c;
insert insertListView;
return Null;
}
}