JavaScript runs on the client, servlets are on the server. In order to invoke a servlet, you must make an HTTP request to the server. Your choices are:
Submit a formSubmit a URLSubmit an Ajax request
(I suppose an
applet or ActiveX control could also be used, but that's going way out there...)