This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Application Scope Variable  RSS feed

 
Sergio Felix
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to create a ConnectionPoolManager (a singleton) that should be available to all my JSP's that need to connect to the DB. How can I create a variable with an application scope?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you not using container-manager connection pooling? And, you should not be putting Java code, let alone DB access code within JSPs.
 
Sergio Felix
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I have:

JSP's (view)

a bunch of java classes (control)

a bunch of java classes (containers)

a bunch of java classes (model)

I'm trying to use this:
http://homepages.nildram.co.uk/~slink/java/DBPool/

On the documentation they say:
"For instance, in a web application the pool manager could be created and assigned to an application scope variable, where it could be accessed by other classes which require database access."

So what I tried to do is:

1.- Make a Control class (this should instantiate the pool manager). Like this:


2.- Make a control for each of the different entities I need to use. For example:



3.- The containers look like this:




4.- I call on the controls in my JSP like so:



Does this sound good to you? Is this a container-manager connection pooling? What patterns should I use?



[ November 05, 2008: Message edited by: Sergio Felix ]
[ November 05, 2008: Message edited by: Sergio Felix ]
 
Sergio Felix
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have an idea about this? :S Im worried that I will have several ConnectionPoolManagers insted of one o.O
[ November 06, 2008: Message edited by: Sergio Felix ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!