+ Start a Discussion
MrithulaMrithula 

help me in getter setter

hi ,

 

my code is here...

 

i dont knw wat mistake i done...can anyone help me

 

CONTROLLER

 

public class srchstaff {
String src;
String temp;
List<staff_details__c> stafflst;
public staff_details__c staff{set;get;}

public srchstaff()
{
staff=new staff_details__c();

}
public String getstaff() {
return temp;
}

public void setstaff(String s) {
src=s;
temp='%' + src + '%';
}

public List<staff_details__c> getstafflst() {
return stafflst;
}

public PageReference doSearch() {
if (temp != null)
{
stafflst = (List<staff_details__c>)[select Name,Mobile__c,EMail__c,Position__c from staff_details__c like :temp];
}

return null;

}}

 

 


PAGE:

 


<apex:page Controller="srchstaff">
<apex:form >
<apex:pageBlock >

<apex:pageblockSection title="Search Doctor Details Here" >

<apex:inputText value="{!src}" label="Doctor Name"/>

</apex:pageblockSection>

<apex:pageBlockButtons location="bottom">

<apex:commandButton value="SEARCH" action="{!doSearch}"/>

</apex:pageBlockButtons>

 

<apex:pageBlockTable value="{!stafflst}" var="m">
<apex:column value="{!m.Name}"/>
<apex:column value="{!m.Mobile__c}"/>
<apex:column value="{!m.EMail__c}"/>
<apex:column value="{!m.Position__c}"/>

</apex:pageblocktable>

 

</apex:pageBlock>
</apex:form>
</apex:page>

Shiv ShankarShiv Shankar

What error you are getting ?