jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Best Approach to Follow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Best Approach to Follow" Watch "Best Approach to Follow" New topic

Best Approach to Follow

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
Hi All,

We have an application, which needs to be restructered to MVC2 architecture.
My problem is that the code of the current application is very messy.

1. JSP contains too much Business Logic.
2. Resultset is being used in JSP.
3. All JSP contains same javascript.
4. Almost all of the classes are interacting with the DB. There is no seperation of DB related logic.
5. Request object is being passed to almost all of the classes.
6. No single point of talk for JSP's, like beans or VO's.

My problem is, which would be an easier approach. Re-structering the current application or creating a new one from the scratch.My personal opinion is that creating a new application from the scratch, especially when all the developers are new, including me . But my manager thinks otherwise. Per him we don't have much time.

Current Architecture is: JSP talking directly to Business classes. No servlet is used. No beans.

-Thanx in advance.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Whether you rewrite or restructure, you will want to do certain things. You would want the business logic in JavaBeans, you will want a clean separation of your layers. So, get your JSPs to talk to your JavaBeans via a Business Delegate and get your JavaBeans talking to the DB via a DAO. Use Transfer Objects as parameters and return values.

The bare minimum design would be something like this:

JSPs <--> Business Delegate <--> JavaBeans <--> DAO <--> DB

It may be easiest to agree with your manager's view but then effectively rewrite the application .

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
I agree. Here's the link: http://aspose.com/file-tools
subject: Best Approach to Follow
It's not a secret anymore!