软件毕设外文翻译

上传人:桔**** 文档编号:460239138 上传时间:2022-07-13 格式:DOC 页数:18 大小:197.50KB
返回 下载 相关 举报
软件毕设外文翻译_第1页
第1页 / 共18页
软件毕设外文翻译_第2页
第2页 / 共18页
软件毕设外文翻译_第3页
第3页 / 共18页
软件毕设外文翻译_第4页
第4页 / 共18页
软件毕设外文翻译_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《软件毕设外文翻译》由会员分享,可在线阅读,更多相关《软件毕设外文翻译(18页珍藏版)》请在金锄头文库上搜索。

1、Strutsan open-source MVC implementationBy Christian Kirkegaard and Anders Moller,BRICS, University of Aarhus, DenmarkThis article introduces Struts, a Model-View-Controller implementation that uses servlets and JavaServer Pages (JSP) technology. Struts can help you control change in your Web project

2、 and promote specialization. Even if you never implement a system with Struts, you may get some ideas for your future servlets and JSP page implementation.IntroductionKids in grade school put HTML pages on the Internet. However, there is a monumental difference between a grade school page and a prof

3、essionally developed Web site. The page designer (or HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility, image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java developers are more interested i

4、n creating a great looking object interface than a user interface. JavaServer Pages (JSP) technology provides the glue between the page designer and the Java developer. If you have worked on a large-scale Web application, you understand the term change. Model-View-Controller (MVC) is a design patter

5、n put together to help control change. MVC decouples interface from business logic and data. Struts is an MVC implementation that uses Servlets 2.2 and JSP 1.1 tags, from the J2EE specifications, as part of the implementation. You may never implement a system with Struts, but looking at Struts may g

6、ive you some ideas on your future Servlets and JSP implementations.Model-View-Controller (MVC)JSP tags solved only part of our problem. We still have issues with validation, flow control, and updating the state of the application. This is where MVC comes to the rescue. MVC helps resolve some of the

7、issues with the single module approach by dividing the problem into three categories: ModelThe model contains the core of the applications functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or con

8、troller. ViewThe view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. ControllerT

9、he controller reacts to the user input. It creates and sets the model. MVC Model 2The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to notify the view of chan

10、ges. On the Web, the browser has to re-query the server to discover modification to the state of the application.Another noticeable change is that the view uses different technology for implementation than the model or controller. Of course, we could use Java (or PERL, C/C+ or what ever) code to gen

11、erate HTML. There are several disadvantages to that approach: Java programmers should develop services, not HTML. Changes to layout would require changes to code. Customers of the service should be able to create pages to meet their specific needs. The page designer isnt able to have direct involvem

12、ent in page development. HTML embedded into code is ugly. For the Web, the classical form of MVC needed to change. Figure 1 displays the Web adaptation of MVC, also commonly known as MVC Model 2 or MVC 2. Figure 1. MVC Model 2Struts, an MVC 2 implementationStruts is a set of cooperating classes, ser

13、vlets, and JSP tags that make up a reusable MVC 2 design. This definition implies that Struts is a framework, rather than a library, but Struts also contains an extensive tag library and utility classes that work independently of the framework. Figure 2 displays an overview of Struts. Figure 2. Stru

14、ts viewStruts overview l Client browser An HTTP request from the client browser creates an event. The Web container will respond with an HTTP response. l ControllerThe Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a

15、 command design pattern implemented as a servlet. The struts-config.xml file configures the Controller. l Business logicThe business logic updates the state of the model and helps control the flow of the application. With Struts this is done with an Action class as a thin wrapper to the actual busin

16、ess logic. l Model stateThe model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags. l ViewThe view is simply a JSP file. There is no flow logic, no business logic, and no

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号