File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Business Tier + Persistence Tier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Business Tier + Persistence Tier" Watch "Business Tier + Persistence Tier" New topic
Author

Business Tier + Persistence Tier

Julie Desuza
Greenhorn

Joined: Sep 06, 2004
Posts: 3
According to me in MVC2 architecture ��..

JSP + HTML + JSP should be View Part
Action Class + Form Bean + struts-fonfig.xml should be Controller Part
Database + Java Beans should be Model Part

Question is ���..

Model is presentation layer here. Which one is persistence tier and Business Tier in between Model and Controller.

According to me���. Model must be business tier as it encapsulates business logic and Controller must be Persistence Tier���� Kindly correct me if wrong.

Regards,
Julie
Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
Here's my opinion.

MVC is a architecture pattern that comes from smalltalk. The major point in mvc is the decoupling amont 3 pieces: controller, view, model.

In web enviroment, mvc cannot be fully (and naturally) implemented, because there's no such event that states a change in model to the view, that's why they came up with the Model 1 and Model 2 things, which are approaches to simulate mvc in a web enviroment.

People who work with web are used to think on 3 tier applications: Presentation, Business, Persistence. So it's natural to make some kind of "mapping" between mvc and 3 tier applications, something i think is not the best strategy.

In my opinion, we cannot try to make some strong rules. In other words, Business, Presentation, Persisten just don't directly match with Presentation, Model, Control, they are diferent views of an application.

MVC (Model, view=presentation, control) is a higher level abstraction of your application. So you create your business, view and persistence code under this higher level view of mvc. I might be getting confusing here, but i'm trying to make it clear.

The only thing we cannot separate is presentation and view, they are the same thing, but business doesn't map to model or control.

Usually, we implement business in a controller level, but business might also be implemented in the model level. Persistent classes, for example, represent model and we might have some simple business logic there.

So, my advise to you is:
- Presentation logic -> View (MVC): jsps, html
- Business logic -> Control (MVC) and Model(MVC): Action, session ejbs, pojos,etc..
- Persistent logic -> Model(MVC): persistent classes


Well, as i said, this is my opinion.
[ September 06, 2004: Message edited by: Leandro Melo ]

Leandro Melo
SCJP 1.4, SCWCD 1.4
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

Hi friends
Struts is an MVC compliant framework
My openion about your question(s) is

View : is JSP + any ther page produced by template engine or other ways + HTML [generally what ever help you see/insert/delete
some information from your System. its just my openion]

Model : In MVC model is responsible for buisiniss rules and any rule round your application data
[persisting and rules over persistence . IMHO]
Struts does not provide any classes or Stuff for Model.Application would have diffrent models depend on needs
for example you may use Hibernate for preparing Model or JDO , EJB ...

Controller: controler is responsible for relating Model and view and it define the application Flow.
user Actions give Controller some arguments it need to perform some model's operation.
Diffents models need diffrents Controler , In Struts union of Actions , ActionServlet,Config Object (Struts-config.xml)
compose Controler.

Hope it helps.


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Business Tier + Persistence Tier