Lets clear up a common confusion. JavaScript is not Java. Java and Javascript are different technologies made by different companies for different purposes. JavaScript is a scripting language invented by Netscape to programmatically control web browsers. Java is most famous for applets, servlets, and Java server pages.
Applets are small computer programs that get downloaded with a web page.
Servlets are small Java programs that run on a server. Servlets can process HTTP requests and requests from a large variety of other communication protocols. No knowledge of CGI is necessary, they are multiplatform and very fast. Java Server Pages is Sun's answer to Active Server Pages. The tag interface is near identical.