This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello everyone, I am confused between the High level response-request architecture,and MVC architecture.
I use HFSJ book.
In that book, the second chapter shows the request-response cycle. it says that:-
1. The user enters the servlet request. 2. Request goes to Web Container. 3. Web Container creates the Request and Response objects. 4. Web container finds the correct servlet based on the URL. 5. On finding the correct servlet, it creates the thread for that servlet. 6. Web Container puts the user request in the request object and passes the object to the thread. 7. Servlet thread then calls the service() method. 8. On the service method in turn, calls the doGet()or doPost() method depending on the GET or POST request. 9. doGet()or doPost() then will dynamically generate the response page. 10. This response page will then be put into the Response Object. 11. Web Container then will convert this response object into HttpResponse. 12. This HttpResponse is then sent to then client. 13. Web Container the destroys the request and response objects.
MVC architecture Eg.on Page 71 says that:-
1. The client makes a request for form.html 2. The Container retrieves the form.html page. 3. The Container returns the page to the browser. 4. The user answers the questions on the form and sends the request data to the container. 5. Web container finds the correct servlet based on the URL and passes the request to the servlet. 6. The Servlet then calls the BeerExpert Component for help. 7. The expert class returns an answer,which the servlet adds to the request object. 8. The servlet forwards the request to the JSP. 9. The JSP gets the answer from the request object. 10.The JSP generates the page for the container. 11.The Container returns the page to the user.
The questions are:- 1.When or in what situations,do we use either of the architecture? 2.In,MVC architecture,from where did the BeerExpert Component and Result.jsp come from? 3.After comparing these 2 architectures, (i) On finding the correct servlet, (a)It creates the thread for that servlet. Web Container puts the user request in the request object and passes the object to the thread. (b)The Servlet then calls the BeerExpert Component for help.
MVC is built on top of the request, response architecture. In other words, all of the steps from the first list will still occur when using MVC.
The only difference is that, in step 9 (fist list) the servlet doesn't generate the output by itself. Rather, it (the controller) makes calls to your business objects (model) and then forwards to a JSP (view) where the markup is generated.
hi, I got the answer but when do we use ,that is,in what situation do we use either of the architectures? When is the respone page dynamically generated and when do we use business objects and jsp? Where does that business object come from?