Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Attributes for ServletConfig & ServletContext through web.xml

 
Ranch Hand
Posts: 363
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just got this question while reading about ServletConfig and ServletContext. Why it's not possible to set an attribute through web.xml? Maybe something like this:


IMO, the container could construct an object for us from a file!
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Faisal,
nice question.

Can you think in which condition you want ready made objects from container?

Its not container's job.

Yeah container can handle your Db connection and datasource.
Mostly we want some basic plain text data from container to initialize application.
You can make/use your own application to fullfill your requirment..
Like dependency injection in Spring framework.

If any other has difference thinking can put his/her point..

Regards,
Niraj




 
Faisal Ahmad
Ranch Hand
Posts: 363
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps, an object about container itself? I know, we can get this information through methods. But, just for an example. My idea is - let's do in terms of objects. IMO, database connection and data source perfectly match such requirement.

I've never been into big/complex enterprise applications. So, I am sure I'm missing many scenarios where we could implement this idea.
 
reply
    Bookmark Topic Watch Topic
  • New Topic