You need to sign in to do that
Don't have an account?
I am creating simple page with one inputfield and its value is accessed in apex code.
<apex:page controller="resulttab" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!next}" rerender="error"/>
</apex:pageBlockButtons>
<apex:inputField value="{!res.examid__c}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
public class resulttab
{
public result__c res {get; set;}
public String a {get; set;}
public String save()
{
a = res.examid__c;
return a;
next();
}
public List<result__c> next()
{
return [SELECT name__c,college_name__c,branch__c,year__c,semester__c,clgno__c,total__c,status__c,percent__c,marks__c,examid__c FROM result__c WHERE examid__c = a ];
}
}
error:
Error Message: System.NullPointerException: Attempt to de-referen
This is because your save method hasn't been executed by the time your next method is executed.
You can simply use the value in the next method,
E.g.