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 servlet object created by reflaction mechanism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet object created by reflaction mechanism" Watch "servlet object created by reflaction mechanism" New topic
Author

servlet object created by reflaction mechanism

Anant Jagania
Ranch Hand

Joined: Oct 20, 2004
Posts: 49
Hi All,

Does servlet object created using java.lang.reflect.Constructor by container?

Regards,
Anant
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I wouldn't imagine so, Class.forName().newInstance() would do
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by David O'Meara:
I wouldn't imagine so, Class.forName().newInstance() would do


Hi Dave,
can you please more enlighten on your statement..


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Point is, while reflection is certainly used -- how else could a class be instantiated given its class name as a string? -- the exact mechanism is up to the container.

But, in order to create a new instance of a class using the default contructor, I couldn't imagine it doing anything other than what David posted.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Anant Jagania
Ranch Hand

Joined: Oct 20, 2004
Posts: 49
okay... got it...

but container has to fire the init() method of the servlet. Does it mean that after creating an object of servlet container will fier the init() method on it, or again it would be a reflection mechanism to do so?
Anant Jagania
Ranch Hand

Joined: Oct 20, 2004
Posts: 49
Thanks a lot guys.. got the point..
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

[Edit: issues with the moderators should be brought up via email or the JavaRanch forum]
[ March 12, 2007: Message edited by: Bear Bibeault ]

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
 
 
subject: servlet object created by reflaction mechanism
 
Similar Threads
how many instances???
servlet to applet communication using dom object
When will the instance of Servlet be deleted?
servlet Session
Servlet context and config