Suppose I want to build a web application including displaying sports information including baseball, soccer, golf, etc. Each sport has its own web page but they share some similarity, for example, if user goes to a soccer page, user can pick team name, player name, etc. This kind of thing is common for every type sport, but soccer page may need to retrieve something special like soccer tournament info, and golf may need to display golf
grass field information, etc. Such thing is unique for each sport.
So, I can organize my web application in the following two ways ---
1. create ROOT/soccer. Put .jsp .htm for soccer here. Then I have /WEB-INF/classes/, inside this folder I have servlet/, bean/, etc.
Similarly I creat ROOT/golf. Put golf related .jsp, .htm here and then create WEB-INF/classes/, inside that I create servlet/, bean/, etc.
Similarly I create ROOT/baseball/, and so on.
The good thing is it looks clean for each web application and it's self-contained. The problem is inside the servlet/, each sub-application's
servlet may share LOT of common things and just have few lines difference. So, it seems I am doing lot of "copy and paste" and spread the similar code around various applications. Kind of waste ?
2. Another way is to create ROOT/, inside that I have ROOT/image/ where all of the images for soccer, golf are put, in ROOT/servlet/ I create a servlet which handles cases for all of the sports but certainly this servlet gets to be fat because lot of special cases for different sport needs to be considered, then I create ROOT/bean/soccer, ROOT/bean/golf/ to put beans.
The advantage is I don't need to spread lot of similar codes in many locations when they only have little difference. The disadvantage is I may have to make a servlet too fat and too central that every application relies on.
Which way makes more sense ? Please share your thoughts.
thanks,
steve