aspose file tools*
The moose likes Servlets and the fly likes servletConfig!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servletConfig!!!" Watch "servletConfig!!!" New topic
Author

servletConfig!!!

T Rai
Greenhorn

Joined: Apr 16, 2002
Posts: 20
hi all,
i am wondering i can servletConfig be able to carry information stored in web.xml? could you please explain me this mechanism?
thanks.
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
In the web.xml, under the servlet definition, you can define init parameters something like this: (I do not remember exactly, check first)

Or something like that.
Now, in your servlet's init method, you can use

to get "some value".
Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
Originally posted by Phil Chuang:
In the web.xml, under the servlet definition, you can define init parameters something like this: (I do not remember exactly, check first)

Or something like that.
Now, in your servlet's init method, you can use

to get "some value".

yes, inti-param can be defined in web.xml which can be accessed by servletConfig object. but what i am not getting here is how the servletConfig can be able to carry these information?
thanks.
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
Oh, you want the data to persist in the servlet itself?
Simple, just define some instance variables in the servlet, then set them in the init method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servletConfig!!!