I have a VF page which should display the opportunity data but when I search for the data using the input field i am not able to see any output and it's not displaying any output even it has the data .
VF page:
<apex:page controller="SearchController" >
<apex:form >
<apex:pageBlock Title="Edit opportunity details">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Opportunity Name" for="oppid"> </apex:outputLabel>
<apex:inputText id="oppid"/>
</apex:pageBlockSectionItem>
<apex:commandButton value="Search" action="{!executesearch}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageblock title="searched opportunities" rendered="{!searched}">
<apex:pageBlockTable value="{!opportunity}" var="opp">
<apex:column value="{!opp.StageName}"/>
<apex:column value="{!opp.Type}"/>
<apex:column value="{!opp.Name}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Apex controller:
public class SearchController{
public string name{get;set;}
public boolean searched {get;set;}
public list<Opportunity> opportunity {get;set;}
public SearchController(){ //zero arugument constuctor
searched=false;
}
public pagereference executesearch(){
searched=true;
string searchstr = '%'+ name +'%';
opportunity =[select StageName,Name,Type from Opportunity where Name like :searchstr];
return null;
}
}
Can anyone help me what is wrong with the code here