Get your CodeRanch badge!*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between servlets & Applet" Watch "Difference between servlets & Applet" New topic
Author

Difference between servlets & Applet

pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
Hi,

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


Pradeep.Jaladi
Paul Sturrock
Bartender

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
Bartender

Joined: Aug 20, 2001
Posts: 1815
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
Greenhorn

Joined: Dec 15, 2004
Posts: 15
Hi
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


42
pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
Thanx For u r Information I helped a lot
 
wood burning stoves
 
subject: Difference between servlets & Applet
 
Similar Threads
Difference between applet and appletcontext
JSP and Servlets
PLUGIN AND APPLET
JSP and Servlets
JSP and Servlet