aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Servlet's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Servlet Watch "Servlet New topic
Author

Servlet's "configuration" parameters

Faisal Ahmad
Ranch Hand

Joined: Aug 31, 2006
Posts: 355

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
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.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Faisal Pasha wrote:From the API docs:
A ServletConfig object contains the servlet's configuration and initialization parameters.


Where ? All I see is : "A servlet configuration object used by a servlet container to pass information to a servlet during initialization. ".


[My Blog]
All roads lead to JavaRanch
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Faisal Ahmad
Ranch Hand

Joined: Aug 31, 2006
Posts: 355

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.

Its confusing! Hope, you all agree.
Faisal Ahmad
Ranch Hand

Joined: Aug 31, 2006
Posts: 355

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
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://aspose.com/file-tools
 
subject: Servlet's "configuration" parameters