here my question is javax.servlet.http.* is a subpackage of servlet package ,that mean what ever the classes in http package those are already available in servlet package.so what is the reason behind writing these two statements in servlet program.please give solution to me.
As Amod mentioned above "sub packages" are not imported with import statement. That means to import a Class in the package javax.servlet.http, you need to specify the full package name. A partial package name is not enough.
Javax.servlet is a full package name when you consider classes and interfaces in javax.servlet package. For example javax.Servlet can import all interfaces and classes listed in the api Note that Classes and interfaces under java.servlet.http cannot be imported by importing javax.servlet.* Classes and interfaces listed under javax.servlet.http is listed in the api