You need to sign in to do that
Don't have an account?
System.NullPointerException: Attempt to de-reference a null object
Hello Plz resolve this error
This is my apex code
<apex:page standardController="lib_demo__c" extensions="InventoryDetails1" showHeader="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField id="Acession_no__c" value="{!lib_demo__c.Acession_no__c}" />
<apex:commandButton value="Seacrh" action="{!doSearch}" rerender="block" status="status"/>
<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">
<apex:column value="{!l.BookTitile__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
and this is myExtension
public class InventoryDetails1 {
public InventoryDetails1(ApexPages.StandardController controller) {}
String searchText;
List<lib_demo__c> results;
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public List<lib_demo__c> getResults() {
return results;
}
public PageReference doSearch() {
results = (List<lib_demo__c>)[FIND :searchText RETURNING lib_demo__c(BookTitile__c)][0];
// results = (List<lib_demo__c>)[FIND :searchText RETURNING lib_demo__c(lib_demo__c.BookTitile__c)][0];
return null;
}
}
I came to the solution.
I had to use <apex:inputText id="searchText" value="{!searchText}"/>
All Answers
Hi,
Try these changes,
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Chamil's Blog
Thanks for the solution
but still getting the same error .
Its might be any way related to Data Types??
i am using
BookTitile__c TextArea(255)
Acession_no__c Text
I came to the solution.
I had to use <apex:inputText id="searchText" value="{!searchText}"/>