This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between javax.servlet and javax.servlet.http
 
Similar Threads
servlet questions
HFSJ page 81
what's wrong with this?
HF p44 import statement
Compilation error while building the project using Ant