From the API docs:
A ServletConfig object contains the servlet's configuration and initialization parameters.
The HFSJSP book explains very well about ServletConfig object's purpose to give us a servlet's init & startup parameters.
But I didn't find any discussion about "servlet's configuration parameters" in HFSJSP book. Could someone please provide some info about them?
Thanks!
Łukasz Suchecki
Ranch Hand
Joined: Aug 04, 2009
Posts: 55
posted
0
it's easy to check API:
getInitParameter(java.lang.String name)
getInitParameterNames()
getServletContext()
getServletName()
So we can assume that in spec they said 2 times the same - because initParameters = servlet configuration.
Basically the servlet's name is the only servlet configuration the ServletConfig object provides to the servlet in addition to the initialization parameters. But we can't say that init parameters = servlet configuration...
Christophe, you can find it here:
Interface Servlet's API doc -> Method details for init(ServletConfig config) -> Parameters:
config - a ServletConfig object containing the servlet's configuration and initialization parameters
A bit down, inside the method details for getServletConfig() there is no mention of "configuration":
Returns a ServletConfig object, which contains initialization and startup parameters for this servlet.
And if ServletConfig object doesn't deals with any "configuration", then it should have been called as ServletInit object. I am sure it does deals with configuration for a servlet. But, how? What exactly a servlet configuration means??
Chinmaya Chowdary
Ranch Hand
Joined: Apr 21, 2008
Posts: 432
posted
0
Hi, Faisal.
I think, 'configuration' means providing implementation to the ServletConfig API,
Container provides the implementation to the ServletConfig interface. During initialization time it creates the object(implemented class object) and pass it to the init(ServletConfig config) method. This happens by default. If we override this method, then ServletConfig and ServletContext objects will not be available to the servlet. This will remain as normal java object. It confirms that the class is not implementing Servlet API.
This provides the essential configuration to the java class to be a 'servlet'.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.