• Post Reply Bookmark Topic Watch Topic
  • New Topic

Decoupling my Busines logic from DataAccess logic  RSS feed

 
Gabriel Fox
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,i have a class which provides database services like :
class DataAccess
{
public int insertIntoDB()...
public XXXX runQueryWithParameters()...
public XXXX runQueryUsingCallable()...
public XXXX delete()...
etc
}
To perform any database operation my JSP ,i need to import this class ,instantiate it and invoke the appropriate method using parameters captured on my JSP as arguments say to run a query/update/insert/delete.
Question : How do i implement decoupling my DataAccess object from my Business logic in my JSPs.For instance ,if we change the DB in future we do not want to start changing all JSP.
Please,all codes and references will be appreciated . Cheers.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can search this forum for the MVC pattern/architecture. This pattern helps seperate your presentation logic from the data access logic. In a nutshell your Presenatation JSP will call a Servlet or another JSP which does the data access.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!