Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes A basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "A basic question" Watch "A basic question" New topic

A basic question

Hui Zhao
Ranch Hand

Joined: Jul 09, 2007
Posts: 116
Why use servlet?
Since we can establish the interaction with stream socket between
client and server.So what is the purpose of servlet?
Is stream socket not enough founctioned?

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Hui Zhao,

First, please see:
"A basic question doesn't really describe this question very well".

We use servlets because they're a higher level abstraction than sockets. By leveraging the work of those who came before us, we are able to focus more clearly on the task at hand (web developement) and not on low level details of TCP/IP, the OSI layer's, the finer details of the HTTP protocol.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: A basic question
Similar Threads
send socket from applet to servlet
Socket/TCPIP help required
what does this Exception mean???thanx!@!!!
Must close PrintWriter in servlet when done?
Passing Java objects between web apps?!?!?!