• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementation of discussion forum

 
Kalyan Anand
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to develop a discussion forum ... similar to javaranch...for learing experience. please suggest what i should use in which layer... i know that the basic mvc must be followed but should i access the database from jsp using some taglibs or i better access db using servlets ?

any hints on getting started will be quite useful.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither. In a properly structured web application, DB access occurs in the model classes, none of which should have any knowledge of the presentation and controller layers.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kalyan,
I'd like to suggesting looking at existing open source software - for example JForum 3. They follow MVC properly so you could see how they do it.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I access the DB from services (at least when using Java) :p

It's often more instructive to make your own decisions, and once you realize your mistakes, go back in and fix them. Repeat these steps frequently, and eventually you come to understand whatever frameworks and methodologies you're using.

For example, you might start out by using plain servlets and JSPs. Once you have some application functionality you're happy with, you might ask "Here's an example servlet in my forum application; how can I make it better?" Then somebody would say "Oh, use services to handle the database access." So you move your database code into services, and ask "How can I make this better?" Somebody might say "If you inject your services into your servlets it makes testing much easier."

You reply "Testing?!" and create a suite of unit tests and begin injecting the services. Then somebody says "Why aren't you using Spring to do your database work? It's so much easier." Then you use Spring to handle your JDBC (if you're not using an ORM). Along the way to discover that Spring can be used to handle some other functionality you're looking at, including replacing servlets with Spring MVC. Or you might decide that something like Wicket fits the way you think better--or Struts, or Frontman, or Tapestry, or Stripes, or JSF (ew!), or whatever, and re-implement servlets using your new favorite technology.

This goes on forever.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic