servlet is server side , if u wan't to inform the client that an erros has accured u can do that in two simple ways :
a. when an exception has been cought responseredirect him to let's say error.jsp and display and appropiate message
b. include a div which has a
in the bottom of it when default value of visibility is set to hidden and when an error has accured for example failure on sever side validation stick appropiate attribute to session and return back to jsp ....
BOL.