Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between servlets & Applet

 
pradeep jaladi
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is the main difference between Applet & Servlets.
ANd Why Servlets r not "user Interface"
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets == Client side
Servlets == Server side
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any thoughts on which approach, Servlet or Applet, is better in a certain situation?
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pratap Rana
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx For u r Information I helped a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic