, , , MVC MVP. "-" , "" . , " " MVC, .
(Note: I'm NOT a Java developer, C # actually, but you can get an idea)
URL:
/products/532
With re-writing Url, it will be a "web page" and its compiled "code", for example:
/products/showproduct.jsp?productid=532
/products/showproduct.java (code behind)
But with pages in MVC, this will be:
/Controllers/ProductController.java <- ProductController.ViewProduct(int id)
/Models/ViewModels/Product.java <- Product() class
/Views/Product/Index.html <- very simple display of html.
ProductController searches and retrieves the ViewModel of Product (), hooks up the index view, replaces any displayed variables, and finally, ProductController returns the completed html to the client.
This approach abstracts the logic of the web page into code that can be managed, versioned, merged, forked, etc. in your source repository.
source
share