
public integer age{set;get;}
public Employee1(){
}
public pagereference save(){
if( age!=null && age='' ){
return new pagereference('/apex/IF_ELSE_IF');
}else{
apexpages.Message msg= new apexpages.Message(apexpages.Severity.WARNING,'please enter age');
apexpages.addMessage(msg);
return null;
}
}
}
답변 1개
Remove age='' from the If condition because it's data type is Integer and integer can never be blank but can be null value
You can use the below condition
if( age!=null && age==0 ){