How do you know when to use Applet vs. Servlet since (for the most part) they can do the same thing... or can they? ( Still learning this stuff, so gotta ask questions... ) Thanks! [ July 22, 2002: Message edited by: Sam Smoot ]
They are quite different things. An applet is a piece of code which is downloaded by a user's browser, and is run in a strictly-controlled "sandbox" on the user's machine. A servlet is a piece of code which is run on a (typically remote) server. Servlets are typically used to serve up HTML pages for the browser to download, and work together to make a "web application". Applets are typically used to provide little programs which run "in" a browser and provide things not possible with HTML or JavaScript (like moving graphics, or querying a remote database). Confusing them can lead to a lot of misunderstandings about what code is running on which machine.
Ok, sorry 'bout that... I knew that much, but I didn't have enough caffeene yet. What I'm wondering is: If I have a web application that connects to a database, when is it best to use an applet and when do I use a servlet? As to scrolling marquees, etc. there are other technologies (Flash in particular) that are out there that seem to eliminate some needs for an applet class... (ok, beat me up on this one, but you have to have either the player or the correct JRE plugin downloaded, so they're almost even in this respect). Which method would be more secure for data access? Which would be more reliable? Thanks. [ July 22, 2002: Message edited by: Sam Smoot ]