?
Servlets & JSP Series 3 - One Mini MVC Tutorial
?
- Construct the file and directory structure of a web application that may contain: 1.static content; 2.JSP pages; 3.servlet classes; 4.the deployment descriptor; 5.tag libraries; 6.JAR files; 7.Java class files.
- The Steps to build a real web application: 1.Review the user’s views, and the high level architecture; 2.Create the development environment that we will use for this project; 3.Create the deployment environment that we will user for this project; 4.Perform iterative development and testing on the components of our web application.
- The running process of the architecture: 1.The client makes a request for the HTML form page; 2.The Container retrieves the HTML form page; 3.The Container returns the page to the browser, where the user answer the questions on the form; 4.The browser sends the request data to the container; 5.The Container finds the correct servlet based on the URL, and passes the request to the servlet; 6.The servlet calls the Model 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 a page for the Container; 11. The container returns the page to the happy user.
- The steps of performing iterative development and testing on the components of our web application: 1.Bulid and test the HTML form that the user will first request; 2.Build and test version 1 of the controller servlet with the HTML form, this version is invoked via the HTML form and prints the parameter it receives; 3.Build a test class for the expert/model class, then build and test the expert/model class itself; 4.Upgrade the servlet to version 2, this version adds the capability of calling the model class to get beer advice; 5.Build the JSP, upgrade the servlet to version 3, and test the whole app.
- Some standard Java sitting inside <%?? %> tags, it is known as scriptlet code. The container provides a mechanism called “request dispatching” that allows one Container-managed component to call another.
?