function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.