龙心客栈
来源: BlogBus 原始链接: http://www.blogbus.com:80/blogbus/blog/diary.php?diaryid=434154 存档链接: https://web.archive.org/web/20041220071401id_/http://www.blogbus.com:80/blogbus/blog/diary.php?diaryid=434154
龙心客栈 一个讨论j2ee技术以及畅谈程序人生的地方,一个有共同兴趣和爱好的朋友相聚的乐园。 <<<log4j synthetically | 首页 | pooly design on Swing & design pattern>>> What method does the container calls when instantiating servlet 时间: 2004-10-10 Posted By: madhu sudan on October 09, 2004 @ 08:12 AM in response to Message #142094 1 replies in this thread This is what i have understood from the Spec and some reading about Servlets, Step 1. Container reads the Deployment descriptor and read the servlets class name element value say for example: MyServlet com.mycompany.MyServlet <!-- This value will be read. myVariable 1 Step 2: The container loads the class Class clazz = Class.forName("com.mycompany.MyServlet"); Step 3: Creates an Instance of the Servelt class, Servlet objServlet = clazz.newInstance(); The above step will invoke the default contstructor (Zero parameter constructor of the servelt class. The spec dictates that Servlet Code should have a constructor with zero paremeter i.e default constructor). Step 4: The container then reads the initialization parameter "init-param" xml tags, and constructs a ServletConfig object and inovkes the objServlet.init(config) After which the servlet will be move the serviciable state from there on the Servlet instance is ready to service any request from the client. Hope i could make some sense and clear your doubts. Peace, Madhusudan M Krishnamurthy dragonet 发表于 2004-10-10 14:10 引用(Trackback0) 评论 发表评论 最后更新 pooly design on Swing & design pattern an article for thought about Swing What method does the container calls when instantiating servlet log4j synthetically How to estimate a trick about 'How to update multiple value in collection' on Struts How to visit those methods which are not public? 学习java 八卦1: 瑜珈 Analysis Mechanism