Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Some help required - please ...  RSS feed

 
Pat Metheny
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
Except studying some Servlet and JSP theory I never had the opportunity to work on a real life project ... until now. On this project (university course registration) I have a database (SQL Server) with 5 tables and, as I count it yesterday, I'll need around 8 html generated pages to make the application useable. It is not very much business logic in this project. I have some questions to you guys and I would really appreciate it if you can find some time to help me:
1. Which way should I go: Servlet (business logic + generating HTML) or JSP (presentation + logic inside the pages) or both?
2. Which is the best way to handle database sets of data that I�ll get using the SQL statements; should I rely on ResulSet? Should I create a class (a kind of �bean�) to incorporate the result set? I saw some implementations of so called �entities�, each in form of a class, having the members mapped to the result columns of exactly one SELELCT statements; as many SELECT statements were used in the program, as many entities class were created. I�ve learned that this is a very professional approach. Is it so? Is there any book, tutorial, docs explaining this approach in detail?
TIA,
Pat
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use your JSP's for the presentation logic, and servlets / other classes for the business logic.
As for your database access -- this is an EXCELLENT opportunity to learn about and use a Design Pattern.
As I'm sure you've figured out -- database access is a problem that has been encountered over and over... so some smart folks documented the general problem (how to access a database) and a solution (a pattern showing a well known method of handling the situation). A Data Access Object (DAO) is the standard design pattern for Database Access. You can find an explanation of it on Sun's Pattern's pages. Also, check out our very own pattern's forum
 
Pat Metheny
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jessica!
Pat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!