Basically 3 options
1) a listener. [[ head first servlet ]] says this is better than the other option.
2) a specialized servlet. See P368 [[ jsp ]]
I think both put the dataSource object into an “Application/Context scope attribute”
3) spring can achieve the same. Perhaps via one of the above 2.