• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Question

 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic