+ Start a Discussion
steve456steve456 

Java--Apex----Pls help

throw new IllegalArgumentException('Strings must not be null');

 

 

How do i give the above java line in  Apex

force_archforce_arch

In the visualforce page add:

 

<apex:page ... >
<apex:form id="f1"> <apex:pagemessages />
.....
</apex:form> </apex:page>

 

Then in the controller class, add:

 

ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'String must not be null');
ApexPages.addMessage(msg);
steve456steve456

This shoould be given in a apex class not in VF

WizradWizrad

You need to create an exception class for this, then you can throw your own custom exception.