File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Question

 
Dilip kumar
Ranch Hand
Posts: 360
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew,
I need to design a web page which retrieves (from Oracle database) Sales and other information at the department level. This page should provide option to choose different department and date. Along with data this page should show the charting.
I'm planning to use JSP for presentation layer. I was wondering where should I keep the database access logic. Beans or Servlets ?
I was reading you response in some other thread regarding using controller servlet to handle all business logic and then storing the information in beans. Can I use same logic in my web application ?
Thanks much.
 
Andrew Patzer
Author
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dilipkumar Kalyankar:
Andrew,
I need to design a web page which retrieves (from Oracle database) Sales and other information at the department level. This page should provide option to choose different department and date. Along with data this page should show the charting.
I'm planning to use JSP for presentation layer. I was wondering where should I keep the database access logic. Beans or Servlets ?
I was reading you response in some other thread regarding using controller servlet to handle all business logic and then storing the information in beans. Can I use same logic in my web application ?
Thanks much.


You can (and should) use the same logic in your web application. My book describes and builds a simple MVC framework for web applications that keeps a clear separation between the database code, presentation code (JSP's), and navigational code. As you've already read some of my previous posts, I won't go into any more detail, since I think I've pretty much covered my approach to web development. So, in answer to your question, yes the MVC approach does apply to your web application.
Thanks
 
Dilip kumar
Ranch Hand
Posts: 360
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response. I was in Barnes & Noble today but couldn't find your book. I will check again.
 
James Carman
Ranch Hand
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Business logic, if you're not using EJBs, should not be in any servlet class. It should be able to run without the servlet container even being there (at least as far as its concerned). Servlet classes (and Struts action beans) are used for presentation support/flow of control for your web application. One good litmus (sp?) test, your business logic code should not import javax.servlet or javax.servlet.http at all. I would also recommend the Business Delegate design pattern, in case you ever wish to switch to EJBs in the future. This pattern provides a simple solution for migration to EJBs. Check it out at Sun's J2EE Patterns Catalog.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic