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 why creating an Object of an servlet and calling it isn't possible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "why creating an Object of an servlet and calling it isn Watch "why creating an Object of an servlet and calling it isn New topic
Author

why creating an Object of an servlet and calling it isn't possible

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Assume that i have two servlets in my Container , namely First and Second Servlet .

For example



Why isn't it allows to create an Object for a Servlet in Secons and call it for example inside my First Servlet



}

Save India From Corruption - Anna Hazare.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

What would this possibly achieve ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
That depends on what you mean by "allowed". It's perfectly possible to do this, but will most likely not achieve what you intend to achieve.

Read up on the servlet life cycle to understand how servlets work.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

but will most likely not achieve what you intend to achieve.


could anybody tell me the reason why is this like that .
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

No idea. What is is you are trying to achieve?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Because you apparently do not understand the servlet life cycle. Which books/articles/tutorials have you read about that? If the answer is "none", start by doing that. If the answer is something other than "none", the follow-up question is "what did or did you not understand about what you read?".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why creating an Object of an servlet and calling it isn't possible