What is my web app coded in?
I originally planned to build my web app in a MVC pattern, i was just wondering if it me开发者_如何学JAVAets that?
I currently have this
Index page ------(Ajax Requests)---> Controllers ------> model
The data however seems to go from the model back to the controller and then passed back to the index page via ajax. I also use a bean for user login details..
What sort of architecture is this? Is it MVC, (there is no view?)
Thanks
That depends on the point of view.
From the client side point of view:
- Model: the webservice.
- Controller: the JS/Ajax code.
- View: the HTML DOM tree.
From the server side webservice point of view:
- Model: the business code.
- Controller: whatever servlet you used to control the request/response.
- View: the JSP page.
From the server side business point of view:
- Model: database entities.
- Controller: business domain objects.
- View: the webservice.
Well... you index page is the view, so it qualifies as "MVC".
But bear in mind that "MVC" is a pattern for the presentation tier, and the "Model" is not only the Database but all the business logic associated with it. There is a common misconception that View=Presentation Tier, Controller=Business Logic tier and Model=Database tier. Check out the J2EE blueprints and the Wikipedia article about it.
精彩评论