wood burning stoves 2.0*
The moose likes Servlets and the fly likes difference between javax.servlet and javax.servlet.http Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "difference between javax.servlet and javax.servlet.http" Watch "difference between javax.servlet and javax.servlet.http" New topic
Author

difference between javax.servlet and javax.servlet.http

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
Hi all,
I am just after a brief description on what is the difference between javax.servlet and javax.servlet.http (very general and simple).
If someone could please tell me that would be great.
David
david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
I might just reword my question. I know that servlethttp extends servlet but would you ever want to use servlet directly or you would always use servlethttp.
thanks
david
Dani Mazzuca
Ranch Hand

Joined: May 21, 2003
Posts: 70
Hi,
First af all, Servlet is an interface, and HttpServlet is a class.
In general javax.servlet package has all the classes/interfaces not directly tied to HTTP, and java.servlet.http package has the classes/interfaces that deals with the http protocol.
If you are going to use HTTP, you should extend the class HttpServlet (wht you normally do). If you are not going to use HTTP, you can extend just GenericServlet, that implements the generic interface Servlet, but it is not tied to HTTP.
Dani
 
 
subject: difference between javax.servlet and javax.servlet.http