Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

frank help!!again

 
asheet anand
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi frank,
thanks for your reply.i will also take care now in lower-upper
case in java.
now,what i have understood in "super.init(ServletConfig s1)"
is that if you give this method in a sub-class of Generic
class than s1 is stored as a refrence in generic class.this s1
contains all the initializaton parameters and also
ServletContext() object.
super.init() is a must because getServletConfig() method returns the same ServletConfig object,which we have passed through the
init() method of the subclass.
please explain to me how ServletContext() palys a role in this
process.
how a method like getInitParameter() which is called with a
ServletConfig Reference is called on its own after this(
super.init()) method.
is this because now the getInitParameter() on its own find out
that there is a ServletConfig() refrence passed to the Generic
class or it is a method that can be called on itself().
i hope i am clear this time.please explain to me ,if possible
in steps ,how this works.
i will be highly obliged.
thanking you,
asheet
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important thing to notice is that your call to getInitParameter() is made to the current class. The current class is your servlet, which extends HttpServlet, which extends GenericServlet. Neither your class nor HttpServlet override the getInitParameter method, so the call uses the one provided by GenericServlet. The code for GenericServlet might look something like this:

Does this help?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic