Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Implementation of discussion forum

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41085
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Do Re Mi Fa So La Tiny Ad
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic