当前位置:首页 > Spring和MyBatis的外文翻译分析
data we received from the input. 1.3 MVC Model 2 : The model 1 architecture was able to solve some of the problem of the web and internet programming but still there were a lot of things missing from it. It was centered on the navigation of the jsp pages so there was the scope of the further development in the architecture point of view. During this process the next development was the Model 2 architecture. This problem was solved using the Servlet and JSP together. The Servest handles the Initial request and partially process the data. It set up the beans then forward the result to the one of the jsp page. The Servlet decide the one of the page to be displayed from the list of pages. In this Model 2 architecture the JSP Pages were used to Presentation purpose only. The Business logic has been removed from the page. This makes the pages easier to represent and light weight pages which were easy to display on the internet. In this model all Control and application logic were handled by the Servlet. The Servlet was written in the java programming language. So it was also easier to handle 共9页 第 8 页
the programming part of the Servlet. In this scenario the Servest becomes the power full for the complete application and It has emerged as the center point for the application. In the model 2 architecture the Servlet becomes the gatekeeper for the all common tasks. It provides the common services like authentication, authorization, error control and follow of the application. This architecture have solved the most of the problems. But still there were many new issues emerged while applying this architecture. II. APPLYING ARCHITECTURE WITH MULTIPLE FRAMEWORKS Web and Internet is ever growing area and the demands for the applications are growing. A single framework is not capable to handle the architecture of the application. To meet the currents requirement of the applications it’s necessary to design a architecture to implement the frameworks. Struts framework have been designed and developed for the front end control of the web applications. It provides the various features for the applications that interact to the users. It also follows the MVC 2 design features. Spring Framework is the designed to handle the various tasks. The spring work for the desktop and internet based applications also. It follows the principals of the MVC 2. The simultaneous use of the Struts and spring frameworks in the single application with the applying the MVC Design principals so that we can Improve the performance of the applications. Struts Framework consists of three major blocks, Described in brief as follows: First is The View Block which controls the presentation part of the complete model. This contains following JSP files which you write for your specific application Set of JSP custom tag libraries Resource files 共9页 第 9 页
for internationalization. Second Block is representing the Controller. This is for navigation the complete application. This contains XML configuration files; it contains the tags for the navigation of the paths. Third Block is the Model. This part do the work of the Business Logic, Fetching and storing data to the database.This contains following Java Beans Enterprise Java Beans Database. Following figure shows the working of the components in the struts framework. MVC in Struts The major three parts of the MVC are as follows in the spring framework. Servlet controller (Controller Part) Java Server Pages or any other presentation technology (View Part) Application Business Logic: in the form of whatever suits the application (Model Part). SpringComponents. In the spring we also follows the principals of the MVC . It has been designed more for the desktop and internet based applications. Spring consist of three core collaborating components. 1. Controller: Handles navigation logic and interacts with the Service tier for business logic 2. Model: The contract between the Controller and the View Contains the data needed to render the View Populated by the Controller 3. View: Renders the response to the request Pulls data from the model. Core components in the spring MVC are as follows. DispatcherServlet: Spring’s Front Controller implementation. It is the first controller which interacts to the requests. We can also say it is an implementation of the Servlet. It controls the complete flow of the application. 2. Controller: User created component for handling requests encapsulates 共9页 第 10 页
navigation logic delegates to the service objects for business logic. 3.View: Responsible for rendering output. Different views can be selected for the different types of output bases on the results and the viewing device, communication devices. 4.ModelAndView: ModelAndView is the core part of the spring framework. It implements the business logic of the application. It is controlled by the controller. It stores the business logic and the view associated with it. Whenever it is executed it will the data with the name of the view. 5. ViewResolver: How the output is to be displayed depends on the result received from ModelAndView. It is used to map logical view names to actual view implementations. This part identifies and implement what is the output media and how to display it. 6. HandlerMapping: Strategy interface used by DispatcherServlet for mapping incoming requests to individual Controllers. It identifies the request and calls the respective handler to provide the services. The following figure shows how the model will work. In this the dispatcher Servlet is the entry point for the application. The Struts parts do it’s work and send the request to the dispatcher Servlet. The Servlet decides the handler. Then it will call to the controller. Controller will execute the ModelAndView. III. PROPOSED METHODOLOGY This approach is based a combination of applying the two framework struts and spring for the application development. The sequence diagram for the combined application is explained as above, which is the main driving force for the application. This approach assumes that basic knowledge of web applications is essential. We have tested the above concepts and find out it successfully. Major benefits 共9页 第 11 页
共分享92篇相关文档