File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes import javax.servlet.*; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "import javax.servlet.*;" Watch "import javax.servlet.*;" New topic
Author

import javax.servlet.*;

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296

As we know in every Servlet we are importing servlet package even though if we dont import this package this code will compile what is the use of using servlet package any how HTTpServlet package is used in our code for proceesing the request and response .


Creativity is nothing but Breaking Rules
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

See the JavaDocs. This will explain what all the classes in that package are for.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3848

santhosh.R gowda wrote:As we know in every Servlet we are importing servlet package even though if we dont import this package this code will compile


How ? Have you tried it ?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Sorry for miss judging now i got the solution also ...in servlet package servlet Exception class has been there so in dopost if we write throws servletException it could not find the exception class we throws so it gives us the compiler error wright.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3848

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14338
    
  22

It seems like you don't fully understand the concept of packages and what the import statement does. Have a look at Creating and Using Packages in Sun's Java Tutorials.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Thanks for all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: import javax.servlet.*;