Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP and Databases

 
Jon Eversett
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm a JSP newbie with a basic knowledge of JSPs and Java beans. I would like some advice on where my db calls should live (bean or JSP) and what the advantages of one location over the other.
Thanks
Jon
 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Model 1 JSPs ( business logic written in JSP scriptlets) have almost become a thing of the past except for very small applications!!!
Model 2 JSP ( MVC ) is better as it separates your business logic and your presentation logic, and it also allows your web pages to be edited by content developers easily.
You can read about a MVC framework like struts to know the advantage of model 2 JSP. You can get more info on struts in the following URL
http://jakarta.apache.org/struts/
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jon,
I use a java class to do db access - DAO. The class is called in servlets or JSP. I normally use a servlet to call DAO to leave JSP purely for presentation. By using DAO, you also let your servlet to be light weight to concentrate on transfer control.
This is what I do.
Hope help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!