wood burning stoves 2.0*
The moose likes JSP and the fly likes about making database connection through JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "about making database connection through JSP" Watch "about making database connection through JSP" New topic
Author

about making database connection through JSP

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
My friend advised me that it is not a good practice to create a database connection using a JSP instaed of a servlet as it is availble outside WEB-INF package.

what is the real scenario behind this? what are the disadvantages in making a DB connection using JSP?

regards
Surendarprabu


SCJP 1.4
vishwanath nadimpally
Ranch Hand

Joined: Jan 25, 2005
Posts: 116
A jsp is meant for presentation.

The normal practice is to have javabeans which are like special java classes with properties and getters and setters for these properties and have java classes which make the actual database calls to get and set the values for a java bean.

The normal practice is to instantiate your beans inside a servlet or jsp and put them in session as you need them.
 
 
subject: about making database connection through JSP