Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about making database connection through JSP

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic