Question:
Java MVC(Model-view-controller) pattern ?
Margus M
2008-06-05 08:50:59 UTC
Reminder what MVC is:
http://en.wikipedia.org/wiki/Model-view-controller

I'm unfamiliar with MVC, (also Hibernate and Struts 2.0), but i need to implement the pattern MVC in 12h for my school work (some client shop thing'y)(also need to use Java server and oracle or postgres database)(oracle is out, because i do not have an account). (Starting from scratch after this post ...)

I can make schema, database, database entries, connection, Java buisness logics, Jsp page that produce jSon objects, jsp grid pages that post queries, and read the jSon objects.

What i can not do, is to read, how to use the new technology (as i do not have the time). I need someone to validate, if i have everything for that pattern, and maybe give an overview what MVC is (based on parts i choose to use).
Three answers:
Chris C
2008-06-05 10:04:24 UTC
Model-View-Controller is more of a architectural decision rather than a technology. Designing your solution so it fits within the MVC Pattern is key.



You say you are familiar with JSP's, database connections, and java business logic - that is a great start. Now the trick is putting them together in a project to optimize the MVC framework.



The JSP is going to become your View. Within this view there should be code to gather information (and nothing more). This information will be passed into the Controller and it will decide what needs to be done. Often the controller is a servlet or some frameworks such as Struts may handle it for you. The controller will call into the Model classes to access the database information. These model classes are often called Database Access Objects (DAO) - their only job is to access the database and perform operations specified by the Controller.



This is a quick run-down of the MVC as I see it. Check out the Sun website for more details.



-Chris
Jim Maryland
2008-06-05 09:05:08 UTC
Not sure if you can use BEA WebLogic (Java Server) or not, but they generally have decent tutorials on implementing various programming patterns. The link below is for Hibernate and mentions Struts. You may also want to search the Eclipse documents/forums to see if they illustrate a similar tutorial to what you want to do.
2008-06-05 23:45:06 UTC
just use eclipse for developing your project. its automatically creates your project in MVC architecture


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...