wood burning stoves 2.0
The moose likes Beginning Java and the fly likes Difference between servlets & Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between servlets & Applet" Watch "Difference between servlets & Applet" New topic

Difference between servlets & Applet

pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65

What is the main difference between Applet & Servlets.
ANd Why Servlets r not "user Interface"

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Applets == Client side
Servlets == Server side

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Chris Staten
Ranch Hand

Joined: Sep 24, 2004
Posts: 101
Any thoughts on which approach, Servlet or Applet, is better in a certain situation?
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

With Servlets (and JSP), all the work is done on the server side. It is not true that servlets do not have a user interface -- it's just that their user interface is HTML-based. (Typically, the JSPs are used to provide the user interface and the Servlets act as controllers, but when you get to the nitty-gritty, they are the same thing...).

HTML can then be viewed on web-browers in short time. No downloads, no nothing. Just a nice HTML page. And if you don't serve up any dynamic HTML (with Javascript and the like), then your pages will be displayable pretty much anywhere.

Applets, however, require download time to work. They run in a restricted environment on the local computer -- all processing is done locally. Depending on the machine, this might not be a problem. But I've get a 9-year-old Macintosh Performa 637 running a 33MHz processor and with 16Mb RAM (and a 350 Mb hard drive) that can browse out to the web and view straight HTML no problem -- but just try to get that thing to run an applet.

On the other hand, applets can make use of Swing, and thus have a much more user-friendly UI.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Pratap Rana

Joined: Dec 15, 2004
Posts: 15
Servlet: are meant for generating HTML dynamically.
Applet : are meant for Client side interface or can included in HTML page

Why Servlets r not "user Interface" ?

Servelts are not meant for user inteface but one can use servlet to generate HTML user interface.There is no restriction for using this kind of process.But maintaining HTML code inside servlet is difficult.So sun introduced JSP to solve the problem.Generally Servlets are used as Controllers and JSP used as view.(Refer to MVC Architecture if u need more information)

Hope this will help u
[ December 20, 2004: Message edited by: Pratap Rana ]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Originally posted by Chris Staten:
Any thoughts on which approach, Servlet or Applet, is better in a certain situation?

that depends on the situation

pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
Thanx For u r Information I helped a lot
I agree. Here's the link: http://aspose.com/file-tools
subject: Difference between servlets & Applet
It's not a secret anymore!