aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Model of MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Model of MVC" Watch "Model of MVC" New topic

Model of MVC

Renata fonseca
Ranch Hand

Joined: Mar 15, 2002
Posts: 48
I'd like to understand the actual meaning of "Model" of MVC.
I know that it encapsulates the Business Logic, but what is exactly "Business Logic"?
- Some authors say that it encapsulates the data...
- Other people say that encapsulate code to interact with a database...
- Others say that encapsulates data and functions...

What is the true?
boyet silverio
Ranch Hand

Joined: Aug 28, 2002
Posts: 173
on the '-'s
those are right as long as they pertain to the "business" of the client whom you are making a program for.
As for "business logic", this could refer to the way one implements a "business rule" in a program. For example if we have the following business rule:
"A customer order worth more than 5,000 dollars will be applied a discount of 15% on the total price"
And implemented in code in the following sample:

the logic behind the sample code is the "business logic".
As for "model", the sample Order class could represent a data "model". It encapsulates data such as customer, date of purchase, total amount, etc.. It could also interact with the database when saving or extracting these items - with the help of another class or not. It encapsulates business function e.g. getDiscount...
For an MVC framework, business logic e.g. represented by code that computes the discount inside a view component would not be proper as in the following

Instead an OrderBean "loaded" and received from another component via a controller can be used e.g.

Or, for those who find java code inside web pages as evil , they create custom tag to use e.g.

Of course, there are better implementations out there ... and examples...
hope this helps.
[ May 25, 2003: Message edited by: boyet silverio ]
Jason Qiu

Joined: May 20, 2003
Posts: 13
Velocity and Structs are excellent implemention of MVC for Java servlets.
They are also very popular applications for Servlets development now.
Check them on
It is sorta covered in the JavaRanch Style Guide.
subject: Model of MVC