Java and PL SQL

Hi guys, I'm trying to figure out how can I catch an error validating data in MySQL

So basically my MySQL trigger says:

Java Code:

Begin
If new.string="" then // string carries the content of a JtextField
// return an error string
Else
// insert into MySQL the data
End

So I want to know if the string in my insert sentence is empty, how can I return a message with a simple System.out.print that indicates to the user that in order to proceed he needs to fill the field in his form.

Knowing this basic example I'll be able to create complex ones, thanks in advance!