File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
Consider Paul's rocket mass heater.
 
subject: about making database connection through JSP
 
Similar Threads
Using SQL in a JSP
Communications link failure Last packet sent to the server was 0 ms ago
Connection pooling vs using a single connection
How many types exists for accessing the database?
Doing JDBC with servlets