wood burning stoves 2.0*
The moose likes JSP and the fly likes Design Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Design Question" Watch "Design Question" New topic
Author

Design Question

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
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

Joined: Jul 11, 2002
Posts: 30
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


Andrew Patzer<br /> <br />Author of: <br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/1590590201/ref=ase_electricporkchop/103-9402848-9855031" target="_blank" rel="nofollow">JSP Examples and Best Practices</a><br /> <br /><a href="http://www.amazon.com/exec/obidos/tg/detail/-/1590594118/qid=1109107718/sr=1-7/ref=sr_1_7/104-5148852-3564711?v=glance&s=books" target="_blank" rel="nofollow">Foundations of JSP Design Patterns</a>
Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Thanks for the response. I was in Barnes & Noble today but couldn't find your book. I will check again.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
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.


James Carman, President<br />Carman Consulting, Inc.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Design Question