毕业设计JSP MVC外文翻译

合集下载

毕业设计英文翻译JSP

毕业设计英文翻译JSP

JSP OverviewJSP is the latest Java technology for web application development and is based on the servlet technology introduced in the previous chapter. While servlets are great in many ways, they are generally reserved for programmers. In this chapter, we look at the problems that JSP technology solves, the anatomy of a JSP page, the relationship between servlets and JSP, and how the server processes a JSP page.In any web application, a program on the server processes requests and generates responses. In a simple one-page application, such as an online bulletin board, you don't need to be overly concerned about the design of this piece of code; all logic can be lumped together in a single program. However, when the application grows into something bigger (spanning multiple pages, using external resources such as databases, with more options and support for more types of clients), it's a different story. The way your site is designed is critical to how well it can be adapted to new requirements and continue to evolve. The good news is that JSP technology can be used as an important part in all kinds of web applications, from the simplest to the most complex.Therefore, this chapter also introduces the primary concepts in the design model recommended for web applications and the different roles played by JSP and other Java technologies in this model.The Problem with ServletsIn many Java servlet-based applications, processing the request and generating the response are both handled by a single servlet class. shows how a servlet class often looks.Example 3-1. A typical servlet classpublic class OrderServlet extends HttpServlet {public void doGet((HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {("text/html");PrintWriter out = ( );if (isOrderInfoValid(request)) {saveOrderInfo(request);("<html>");(" <head>");(" <title>Order Confirmation</title>");(" </head>");(" <body>");(" <h1>Order Confirmation</h1>");renderOrderInfo(request);(" </body>");("</html>");}...If you're not a programmer, don't worry about all the details in this code. The point is that the servlet contains request processing and business logic (implemented by methods such as isOrderInfoValid() and saveOrderInfo( )), and also generates the response HTML code, embedded directly in the servlet code using println( ) calls. A more structured servlet application isolates different pieces of the processing in various reusable utility classes and may also use a separate class library for generating the actual HTML elements in the response. Even so, the pure servlet-based approach still has a few problems:Thorough Java programming knowledge is needed to develop and maintain all aspects of the application, since the processing code and the HTML elements are lumped together.Changing the look and feel of the application, or adding support for a new type of client (such as a WML client), requires the servlet code to be updated and recompiled.It's hard to take advantage of web page development tools when designing the application interface. If such tools are used to develop the web page layout, the generated HTML must then be manually embedded into the servlet code, a process which is time consuming, error prone, and extremely boring.Adding JSP to the puzzle lets you solve these problems by separating the request processing and business logic code from the presentation, as illustrated in . Instead of embedding HTML in the code, place all static HTML in a JSP page, just as in a regular web page, and add a few JSP elements to generate the dynamic parts of the page. The request processing can remain the domain of the servlet, and the business logic can be handled by JavaBeans and EJB components.Figure 3-1. Separation of request processing, business logic, and presentationAs I mentioned before, separating the request processing and business logic frompresentation makes it possible to divide the development tasks among people with different skills. Java programmers implement the request processing and business logic pieces, web page authors implement the user interface, and both groups can use best-of-breed development tools for the task at hand. The result is a much more productive development process. It also makes it possible to change different aspects of the application independently, such as changing the business rules without touching the user interface.This model has clear benefits even for a web page author without programming skills, working alone. A page author can develop web applications with many dynamic features, usingthe JSP standard actions and the JSTL libraries, as well as Java components provided by open source projects and commercial companies.JSP ProcessingJust as a web server needs a servlet container to provide an interface to servlets, the server needs a JSP container to process JSP pages. The JSP container is responsible for intercepting requests for JSP pages. To process all JSP elements in the page, the container first turns the JSP page into a servlet (known as the JSP page implementation class). The conversion is pretty straightforward; all template text is converted to println( ) statements similar to the ones in the handcoded servlet shown in , and all JSP elements are converted to Java code that implements the corresponding dynamic behavior. The container then compiles the servlet class.Converting the JSP page to a servlet and compiling the servlet form the translation phase. The JSP container initiates the translation phase for a page automatically when it receives the first request for the page. Since the translation phase takes a bit of time, the first user to request a JSP page notices a slight delay. The translation phase can also be initiated explicitly; this is referred to as precompilation of a JSP page. Precompiling a JSP page is a way to avoid hitting the first user with this delay. It is discussed in more detail in .The JSP container is also responsible for invoking the JSP page implementation class (the generated servlet) to process each request and generate the response. This is called the request processing phase. The two phases are illustrated in .Figure 3-2. JSP page translation and processing phasesAs long as the JSP page remains unchanged, any subsequent request goes straight to the request processing phase ., the container simply executes the class file). When the JSP page is modified, it goes through the translation phase again before entering the request processing phase.The JSP container is often implemented as a servlet configured to handle all requests for JSP pages. In fact, these two containers—a servlet container and a JSP container—are often combined in one package under the name web container.So in a way, a JSP page is really just another way to write a servlet without having to be a Java programming wiz. Except for the translation phase, a JSP page is handled exactly like a regular servlet; it's loaded once and called repeatedly, until the server is shut down. By virtue of being an automatically generated servlet, a JSP page inherits all the advantages of a servlet described in : platform and vendor independence, integration, efficiency, scalability, robustness, and security.JSP ElementsThere are three types of JSP elements you can use: directive, action, and scripting. A new construct added in JSP is an Expression Language (EL) expression; let's call this a forth element type, even though it's a bit different than the other three.Directive elementsThe directive elements, shown in , specify information about the page itself that remains the same between requests—for example, if session tracking is required or not, buffering requirements,Table 3-1. Directive elementscomponentsJSP elements, such as action and scripting elements, are often used to work with JavaBeans components. Put succinctly, a JavaBeans component is a Java class that complies with certain coding conventions. JavaBeans components are typically used as containers for information that describes application entities, such as a customer or an order.JSP Application Design with MVCJSP technology can play a part in everything from the simplest web application, such as an online phone list or an employee vacation planner, to complex enterprise applications, such as a human resource application or a sophisticated online shopping site. How large a part JSP plays MVC was first described by Xerox in a number of papers published in the late 1980s. The key differs in each case, of course. In this section, I introduce a design model called Model-View-Controller (MVC), suitable for logic into three distinct units: the Model, the View, and the Controller. In a server application, we commonly classify the parts of the application as business logic, presentation, and request processing. Business logic is the term used for the manipulation of an application's data, such as customer, product, and order information. Presentation refers to how the application data is displayed to the user, for example, position, font, and size. And finally, request processing is what ties the business logic and presentation parts together. In MVC terms, the Model corresponds to business logic and data, the View to the presentation, and the Controller to the request processing.Why use this design with JSP? The answer lies primarily in the first two elements. Remember that an application data structure and logic (the Model) is typically the most stable part of an application, while the presentation of that data (the View) changes fairly often. Just look at all the face-lifts many web sites go through to keep up with the latest fashion in web design. Yet, the data they present remains the same. Another common example of why presentation should be separated from the business logic is that you may want to present the data in different languages or present different subsets of the data to internal and external users. Access to the data through new types of devices, such as cell phones and personal digital assistants (PDAs), is the latest trend. Each client type requires its own presentation format. It should come as no surprise, then, that separating business logic from the presentation makes it easier to evolve an application as the requirements change; new presentation interfaces can be developed without touching the business logic.This MVC model is used for most of the examples in this book. In Part II, JSP pages are used as both the Controller and the View, and JavaBeans components are used as the Model. The examples in Chapter 5 through Chapter 9 use a single JSP page that handles everything, while Chapter 10 through Chapter 14 show how you can use separate pages for the Controller and the View to make the application easier to maintain. Many types of real-world applications can be developed this way, but what's more important is that this approach allows you to examine all the JSP features without getting distracted by other technologies. In Part III, we look at other possible role assignments when JSP is combined with servlets and Enterprise JavaBeans.JSP 概览JSP是一种用于Web应用程序开发的最新的Java技术,它是成立在servlet 技术基础之上的。

MVC设计模式THE-MVC-WEB-DESIGN-PATTERN大学毕业论文外文文献翻译及原文

MVC设计模式THE-MVC-WEB-DESIGN-PATTERN大学毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目:MVC设计模式文献、资料英文题目:THE MVC-WEB DESIGN PATTERN文献、资料来源:文献、资料发表(出版)日期:院(部):专业:班级:姓名:学号:指导教师:翻译日期: 2017.02.14MVC设计模式Ralph F. Grove计算机科学,詹姆斯麦迪逊大学,哈里森堡,美国弗吉尼亚州***************Eray Ozkan计算机科学,詹姆斯麦迪逊大学,哈里森堡,美国弗吉尼亚州*****************关键字:web,web框架,设计模式,模型-视图-控制器模式摘要:模型-视图-控制器模式被引用为许多web开发框架的基础架构。

然而,用于web开发的MVC 版本随着原来的Smalltalk的MVC的演变而发生了一些改变。

本文介绍了对这些变化的分析,并提出了一种独立的Web-MVC模式,用于更准确的描述MVC是如何在web框架中实现的。

1.介绍模型-视图-控制器(Modle-View-Controller,MVC)设计模式被一些web应用框架作为基础架构,例如,Rails,以及Struts。

MVC最初是在施乐帕克研究中心(Goldberg和Robson,1985)开发的Smalltalk编程环境中实现的。

为了适应web框架,MVC已经演变成了另一种方式,最终成为一种不同于其他任何设计模式,也与原始的Smaltalk完全不同的模式的实现。

本文的第一个目标是介绍MVC设计模式,其中包括它的原始形态(第2节)以及现代众所周知的用于web应用框架的变更后的形态(第3节)。

第二个目标是对这个模式演变后发生的变化进行评估,同时呈现演变后版本的有效性(第3节)。

最后,我们提出了一个标准的MVC-Web设计模式的描述,用于反映目前在web框架中模式的使用,同时又能保持原始的MVC中令人满意的特性。

基于MVC的web应用框架的修订版本已经被提出了(Chun, Yanhua, 和Hanhong, 2003) (Barrett和Delaney, 2004)。

毕业设计JSPmvc外文翻译

毕业设计JSPmvc外文翻译

Struts——一种开源MVC的实现这篇文章介绍 Struts,一个使用 servlet 和 JavaServer Pages 技术的一种 Model-View-Controller 的实现。

Struts 可以帮助你控制 Web 项目中的变化并提高专业化。

即使你可能永远不会用 Struts实现一个系统,你可以获得一些想法用于你未来的 servlet 和 JSP 网页的实现中。

简介在小学校园里的小孩子们都可以在因特网上发布 HTML 网页。

然而,有一个重大的不同在一个小学生和一个专业人士开发的之间。

网页设计师(或者 HTML开发人员)必须理解颜色、用户、生产流程、网页布局、浏览器兼容性、图像创建、JavaScript 等等。

设计漂亮的需要做大量的工作,大多数 Java 开发人员更注重创建优美的对象接口,而不是用户界面。

JavaServer Pages (JSP) 技术为网页设计人员和 Java 开发人员提供了一种联系钮带。

如果你开发过大型 Web 应用程序,你就理解“变化”这个词语。

“模型-视图-控制器”(MVC) 就是用来帮助你控制变化的一种设计模式。

MVC 减弱了业务逻辑接口和数据接口之间的耦合。

Struts 是一种 MVC 实现,它将 Servlet 2.2 和 JSP 1.1 标记(属于 J2EE 规)用作实现的一部分。

你可能永远不会用 Struts 实现一个系统,但了解一下 Struts 或许使你能将其中的一些思想用于你以后的 Servlet 和 JSP 实现中。

模型-视图-控制器 (MVC)JSP标签只解决了我们问题中的一部分。

我们依然有验证、流控制、以及更新应用程序结构的问题。

这就是MVC从哪儿来以及来干嘛的。

MVC通过把问题分成三类来帮助解决一些与单模块相关的问题:?Model(模型)模块包括应用程序功能的核心。

模型封装着应用程序的各个结构。

有时它所包含的唯一功能就是结构。

它对于视图或者控制器一无所知。

jsp技术网站设计外文翻译(适用于毕业论文外文翻译+中英文对照)

jsp技术网站设计外文翻译(适用于毕业论文外文翻译+中英文对照)

Combining JSP and ServletsThe technology of JSP and Servlet is the most important technology which use Java technology to exploit request of server, and it is also the standard which exploit business application .Java developers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Java to the other is "a preparation, run everywhere" to bring the concept of Web applications, To achieve a "one-prepared everywhere realized." And more importantly, if followed some of the principles of good design, it can be said of separating and content to create high-quality, reusable, easy to maintain and modify the application. For example, if the document in HTML embedded Java code too much (script), will lead the developed application is extremely complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, can logic is not very clear, a large number of HTML and Java code mixed together. This is the random development of the defects.Early dynamic pages mainly CGI (Common Gateway Interface, public Gateway Interface) technology, you can use different languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in programming, and low efficiency, modify complex shortcomings,it is gradually being replaced by the trend. Of all the new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a good portability, they have been many people believe that the future is the most dynamic site of the future development of technology.Similar to CGI, Servlet support request / response model. When a customer submit a request to the server, the server presented the request Servlet, Servlet responsible for handling requests and generate a response, and then gave the server, and then from the server sent to the customer. And the CGI is different, Servlet not generate a new process, but with HTTP Server at the same process. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling service methods, the method of Servlet arrival of the first judgement is what type of request (GET / POST / HEAD…), then calls the appropriate treatment (DoGet / doPos t / doHead…) and generate a response.Although such a complex, in fact, simply said to Servlet is a Java class. And the general category of the difference is that this type operating in a Servlet container, which can provide session management and targeted life-cycle management. So that when you use the Servlet, you can get all the benefits of the Java platform, including the safety of the management, use JDBC access the database and cross-platform capability. Moreover, Servlet using thread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a higher level of abstraction of a Servlet.It allows conventional static and dynamic HTML content generated by combining an HTML page looks like, but as a Servlet to run. There are many commercial application server support JSP technology, such as BEA WebLogic, IBM WebSphere, JRun, and so on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, and a JSP document, you can put it Fangdao any static HTML files can be placed, do not have to compile, do not have to pack, do not have to ClassPath settings, you can visit as ordinary Web It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML document, but inside contains a number of Java code. It uses. Jsp the suffix, used to tell the server this document in need of special treatment. When we visit a JSP page, the document will first be translated into a JSP engine Java source files, is actually a Servlet, and compiler, and then, like other Servlet, from Servlet engine to handle. Servlet engine of this type loading, handling requests from customers, and the results returned to the customer, as shown below:Figure 1: Calling the process of JSP pagesAfter another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded directly call the Servlet. If you have already been modified, it will be once again the implementation of the above process, translate, compile and load. In fact, this is the so-called "first person to punishment." Because when the first visit to the implementation of a series of the above process, so will spend some time after such a visit would not.Java servlets offer a powerful API that provides access to all the information about the request, the session, and the application. combining JSP with servlets lets you clearly separate the application logic from the presentation of the application; in other words, it lets you use the most appropriate component type for the roles of Model, View and Controller.Servlets, Filters, and ListenersA servlet is a Java class that extends a server with functionality for processing a request and producing a response. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two packages: the javax.servlet package contains classes and interfaces that are protocol-independent, while the javax.servlet.http package provides HTTP-specific extensions and utility classes.What makes a servlet a servlet is that the class implements an interface named javax.servlet.Servlet, either directly or by extending one of the support classes. This interface defines the methods used by the web container to manage and interact with theservlet. A servlet for processing HTTP requests typically extends the javax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's lifecycle. It creates an instance of the servlet class when needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropriate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are methods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Typically you don't implement these methods; the HttpServlet class already takes care of HEAD, OPTIONS, and TRACE requests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a web application.It's important to realize that the container creates only one instance of each servlet. This means that the servlet must be thread safe -- able to handle multiple requests at the same time, each executing as a separate thread through the servlet code. Without getting lost in details, you satisfy this requirement with regards to instance variables if you modify the referenced objects only in the init( ) and destroy( ) methods, and just read them in the request processing methods.Compiling and Installing a ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is distributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib directory. On a Windows platform, you include the JAR file in the CLASSPATH.. Reading a RequestOne of the arguments passed to the doGet( ) and doPost( ) methods is an object that implements the HttpServletRequest interface. This interface defines methods that provide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an object that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This interface defines methods for getting a writer or stream for the response body. It also defines methods for setting the response status code and headers.Using Filters and ListenersThe servlet specification defines two component types beside servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you'reout of luck.FiltersA filter is a component that can intercept a request targeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all requests, such as access control, logging, and charging for the content or the services offered by the application. A filter has full access to the body and headers of the request and response, so it can also perform various transformations. One example is compressing the response body if the Accept-Language request header indicates that the client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URLs starting with the same path elements or having the same extension. ListenersListeners allow your application to react to certain events. Prior to Servlet 2.3, you could handle only session attribute binding events (triggered when an object was added or removed from a session). You could do this by letting the object saved as a sessionattribute(using the HttpSession.setAttribute() method)implement the HttpSessionBindingListener interface. With the new interfaces introduced in the 2.3 version of the specification, you can create listeners for servlet context and session lifecycle events as well as session activation and passivation events (used by a container that temporarily saves session state to disk or migrates a session to another server). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual listener objects in each session.The new types of listeners follow the standard Java event model. In other words, a listener is a class that implements one or more of the listener interfaces. The interfaces define methods that correspond to events. The listener class is registered with the container when the application starts, and the container then calls the event methods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized before they can be used. For instance, they may need a reference to a database or some other external data source and may create an initial information cache in memory to provide fast access even to the first request for data. You can include code for initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approach is to place all this code in one place and let the other parts of the application work on the assumption that the resources are already initialized and available. An application lifecycle listener is a perfect tool for this type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface, with methods called by the container when the application starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairly complex application. Half thepages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control. In real life, it would likely contain even more pages, for instance, pages for access to a shared document archive, time schedules, and a set of pages for administration. As the application evolves, it may become hard to maintain as a pure JSP application. It's easy to forget to include the access control code in new pages.This is clearly an application that can benefit from using a combination of JSP pages and the component types defined by the servlet specification for the MVC roles. Let's look at the main requirements and see how we can map them to appropriate component types:●Database access should be abstracted, to avoid knowledge of a specific dataschema or database engine in more than one part of the application: beans in therole of Model can be used to accomplish this.●The database access beans must be made available to all other parts of theapplication when it starts: an application lifecycle event listener is the perfectcomponent type for this task.●Only authenticated users must be allowed to use the application: a filter canperform access control to satisfy this requirement.●Request processing is best done with Java code: a servlet, acting as the Controller,fits the bill.●It must be easy to change the presentation: this is where JSP shines, acting as theView.Adding servlets, listeners, and filters to the mix minimizes the need for complex logic in the JSP pages. Placing all this code in Java classes instead makes it possible to use a regular Java compiler and debugger to fix potential problems.Centralized Request Processing Using a ServletWith a servlet as the common entry point for all application requests, you gain control over the page flow of the application. The servlet can decide which type of response to generate depending on the outcome of the requested action, such as returning a common error page for all requests that fail, or different responses depending on the type of client making the request. With the help from some utility classes, it can also provide services such as input validation, I18N preparations, and in general, encourage a more streamlined approach to request handling.When you use a servlet as a Controller, you must deal with the following basic requirements:●All requests for processing must be passed to the single Controller servlet.●The servlet must be able to distinguish requests for different types of processing.Here are other features you will want support for, even though they may not be requirements for all applications:● A strategy for extending the application to support new types of processingA mechanism for changing the page flow of the application without modifyingcode.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bit with servlets previously, you're probably used to invoking a servlet with a URI that starts with /myApp/servlet. This is a convention introduced by Suns Java Web Server (JWS), the first product to support servlets before the API was standardized. Most servlet containers support this convention today, even though it's not formally defined in the servlet specification.将Servlet和JSP组合使用Servlet和JSP技术是用Java开发服务器端应用的主要技术,是开发商务应用表示端的标准。

JSP及其WEB技术毕业设计论文中英文资料对照外文翻译文献

JSP及其WEB技术毕业设计论文中英文资料对照外文翻译文献

中英文资料对照外文翻译文献JSP及其WEB技术. 1 JSP简介JSP(JavaServer Pages)是一种基于Java的脚本技术。

是由Sun Microsystems 公司倡导、许多公司参与一起建立的一种动态网页技术标准。

JSP技术有点类似ASP 技术,它是在传统的网页HTML文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件(*.jsp)。

用JSP开发的Web应用是跨平台的,即能在Linux下运行,也能在其他操作系统上运行。

在JSP 的众多优点之中,其中之一是它能将 HTML 编码从 Web 页面的业务逻辑中有效地分离出来。

用 JSP 访问可重用的组件,如 Servlet、JavaBean 和基于 Java 的 Web 应用程序。

JSP 还支持在Web 页面中直接嵌入 Java 代码。

可用两种方法访问 JSP 文件:浏览器发送 JSP 文件请求、发送至 Servlet 的请求。

JSP技术使用Java编程语言编写类XML的tags 和scriptlets,来封装产生动态网页的处理逻辑。

网页还能通过tags和scriptlets 访问存在于服务端的资源的应用逻辑。

JSP将网页逻辑与网页设计和显示分离,支持可重用的基于组件的设计,使基于Web的应用程序的开发变得迅速和容易。

Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序段,然后将执行结果连同JSP文件中的HTML代码一起返回给客户。

插入的Java程序段可以操作数据库、重新定向网页等,以实现建立动态网页所需要的功能。

JSP与Java Servlet一样,是在服务器端执行的,通常返回该客户端的就是一个HTML文本,因此客户端只要有浏览器就能浏览。

JSP页面由HTML代码和嵌入其中的Java代码所组成。

服务器在页面被客户端请求以后对这些Java代码进行处理,然后将生成的HTML页面返回给客户端的浏览器。

jsp网站开发毕设外文翻译

jsp网站开发毕设外文翻译

jsp网站开发毕设外文翻译西安邮电大学外文文献翻译院 (系): 计算机学院专业: 计算机科学与技术班级:学生姓名: 导师姓名: 职称:起止时间:2011年 9月23日至 2012年 6月2日原文:Java and the InternetAlthough Java is very useful for solving traditional stand-alone programming problems, it is also important because it will solve programming problems on the World Wide Web.1. Client-side programmingThe Web’s initial server-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Basic HTML contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop-down lists, as well as a button that can only be programmed to reset t he data on the form or “submit” the data on the form back to the server. This submission passes through the Common Gateway Interface (CGI) provided on all Web servers. The text within the submission tells CGI what to do with it. The most common action is to run a programlocated on the server in a directory that’s typically called “cgi-bin.” (If you watch the address window at the topof your browser when you push a button on a Web page, you can sometimes see “cgi-bin” within all thegobbledygook there.) These programs can be written in most languages. Perl is a common choice because it is designed for text manipulation and is interpreted, so it can be installed on any server regardless of processor or operating system.Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with it. However, Web sites built on CGI programs can rapidly become overly complicated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data must be sent, as well as the load on both the serverand the Internet. (On top of this, starting a CGI program tends to be slow.) The initial designers of the Web did not foresee how rapidly this bandwidth would be exhausted for the kinds of applications people developed. For example, any sort of dynamic graphing is nearlyimpossible to perform with consistency because a GIF file must becreated and moved from the server to the client for each version of the graph. And you’ve no doubt had direct ex perience with something as simple as validating the data on an input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI program that discovers an error, formats an HTML page informing you of the error, and then sends the page back to you; youmust then back up a page and try again. Not only is this slow, it’s inelegant.The solution is client-side programming. Most machines that run Web browsers are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just idly waiting for the server to dish up the next page. Client-side programming means that the Web browser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive experience at your Web site.The problem with discussions of client-side programming is that they aren’t very different fromdiscussions of programming in general. The parameters are almost the same, but the platform is different: a Web browser is like a limited operating system. In the end, you must still program, and this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming. 2.Plug-insOne of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new functionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perform this new activity.” (You need to download the plug-in only once.) Some fast and powerfulbehavior is added to browsers via plug-ins, but writing a plug-in is not a trivial task, and isn’t somethingyou’d want to do as part of the process of building a particular site. The value of the plug-in forclient-side programming is that it allows an expert programmer to develop a new language and add that language to a browser without the permission of the browser manufacturer. Thus, plug-ins provide a “back door” that allows the creation of new client-side programming languages (although not alllanguages are implemented as plug-ins).3.Scripting languagesPlug-ins resulted in an explosion of scripting languages. With a scripting language you embed the source code for your client-side program directly into the HTML page, and the plug-in that interpretsthat language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load very quickly as part of the single server hit required to procure that page. The trade-off is that your code is exposed for everyone to see (and steal). Generally, however, you aren’t doing amazingly sophisticated things with scripting languages so this is not too much of a hardship. This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of richer and more interactive graphical userinterfaces (GUIs). However, a scripting language might solve 80 percent of the problems encountered in client-side programming. Your problems might very well fit completely within that 80 percent, and sincescripting languages can allow easier and faster development, you should probably consider a scripting language before looking at a more involved solution such as Java or ActiveX programming. The most commonly discussed browser scripting languages are JavaScript (which has nothing to do with Java; it’s named that way just to grab some of Java’s marketing momentum), VBScript (whichlooks like Visual Basic), and Tcl/Tk, which comes from the popular cross-platform GUI-building language. There are others out there, and no doubt more in development.JavaScript is probably the most commonly supported. It comes builtinto both Netscape Navigatorand the Microsoft Internet Explorer (IE). In addition, there are probably more JavaScript books available than there are for the other browser languages, and some tools automatically create pages using JavaScript. However, if you’re already fluent in Visual Basic or Tcl/Tk, you’ll be mor e productive using those scripting languages rather than learning a new one. (You’ll have your hands full dealing with the Web issues already.)4.JavaIf a scripting language can solve 80 percent of the client-side programming problems, what about the other 20 percent—the “really hardstuff?” The most popular solution today is Java. Not only is it a powerful programming language built to be secure, cross-platform, and international, but Java is being continually extended to provide language features and libraries that elegantly handle problems that are difficult in traditional programming languages, such as multithreading, database access, network programming, and distributed computing. Java allows client-side programming via the applet. An applet is a mini-program that will run only under a Web browser. The applet is downloaded automatically as part of a Web page (just as, for example, a graphic is automatically downloaded).it provides you with a When the applet is activated it executes a program. This is part of its beauty—way to automatically distribute the client software from the server at the time the user needs the client software, and no sooner. The user gets the latest version of the client software without fail and without difficult reinstallation. Because of the way Java is designed, the programmer needs to create only a single program, and that program automatically works with all computers that have browsers with built-in Java interpreters. (This safely includes the vast majority of machines.) Since Java is a full-fledged programming language, you can do as much work as possible on the client before and after making requests of the server. For example, you won’t need to send a request form across the Internet todiscover that you’ve gotten a d ate or some other parameter wrong, and your client computer can quickly do the work of plotting data instead of waiting for the server to make a plot and ship a graphic image back to you. Not only do you get the immediate win of speed and responsiveness, but the general network traffic and load on servers can be reduced, preventing the entire Internet from slowing down. One advantage a Java applet has over a scripted program is that it’s in compiled form, so the sourcecode isn’t available to the client. O n the other hand, a Javaapplet can be decompiled without too much trouble, but hiding your code is often not an important issue. Two other factors can be important. As you will see later in this book, a compiled Java applet can comprise many modules and t ake multiple server “hits” (accesses) to download. (In Java 1.1 and higher this is minimized by Java archives, called JAR files, that allow all the required modules to be packaged together and compressed for a single download.) A scripted program will just be integrated into the Web page as part of its text (and will generally be smaller and reduce server hits). This could be important to the responsiveness of your Web site. Another factor is the all-important learning curve. Regardless of what you’ve heard, Java is not a trivial language to learn. If you’re a Visual Basic programmer, moving to VBScript will be your fastest solution, and since it will probably solve most typical client/server problems you might be hard pressed to justify learning Java. If yo u’re experienced with a scripting language you willcertainly benefit from looking at JavaScript or VBScript before committing to Java, since they might fit your needs handily and you’ll bemore productive sooner.to run its applets withi5.ActiveXTo so me degree, the competitor to Java is Microsoft’s ActiveX, although it takes a completely different approach. ActiveX wasoriginally a Windows-only solution, although it is now being developed via an independent consortium to become cross-platform. Effectively, ActiveX says “if yourprogram connects to its environment just so, it can be dropped into a Web page and run under a browser that supports ActiveX.” (IE directly supports ActiveX and Netscape does so using a plug-in.) Thus, ActiveX does not constrain you to a particular language. If, for example, you’re already an experienced Windows programmer using a language such as C++, Visual Basic, or Borland’s Delphi, you can create ActiveX components with almost no changes to your programming knowledge. ActiveX also provides a path for the use of legacy code in your Web pages.6.Internet vs. intranetThe Web is the most general solution to the client/server problem,so it makes sense that you can use the same technology to solve a subset of the problem, in particular the classic client/server problem within a company. With traditional client/server approaches you have the problemof multiple types of client computers, as well as the difficulty of installing new client software, both of which are handily solved with Web browsers and client-side programming. When Web technology is used for an information network that is restricted to a particular company, it is referred to as an intranet. Intranets provide much greater security than the Internet, since you can physically control access to the servers within your company. In terms of training, it seems that once people understand the general concept of a browser it’s much easier for them to deal with differences in the way pages and applets look, so thelearning curve for new kinds of systems seems to be reduced.The security problem brings us to one of the divisions that seems to be automatically forming in the world of client-side programming. If your program is running on the Internet, you don’t know what platform it will be working under, and you want to be extra careful that you don’t disseminate buggy code. You need something cross-platform and secure, like a scripting language or Java. If you’re running on an intranet, you might have a different set of constraints. It’s not uncommon that your machines could all be Intel/Windows platforms. On an intranet, you’re responsible for the quality of your own code and can repair bugs when they’re discovered. In addition, you might already have abody of legacy code that you’ve been using in a more traditional client/server approach, whereby you must physically install clientprograms every time you do an upgrade. The time wasted in installing upgrades is the most compelling reason to move to browsers, because upgrades are invisible and automatic. If you are involved in such an intranet, the most sensible approach to take is the shortest path that allows you to use your existing code base, rather than trying to recode your programs in a new language.When faced with this bewildering array of solutions to the client-side programming problem, the bestplan of attack is a cost-benefit analysis. Consider the constraints of your problem and what would be the shortest path to your solution. Since client-side programming is still programming, it’s always a good idea to take the fastest development approach for your particular situation. This is an aggressive stance to prepare for inevitable encounters with the problems of program development.翻译:Java和因特网Java除了可解决传统的程序设计问题以外,还能解决World Wide Web(万维网)上的编程问题。

jsp在线问卷调查系统的分析与实现毕业设计英文文献翻译

jsp在线问卷调查系统的分析与实现毕业设计英文文献翻译

jsp在线问卷调查系统的分析与实现毕业设计英文文献翻译毕业设计说明书英文文献及中文翻译班级: 学号:姓名:软件学院学院:软件工程专业:指导教师:2014 年 6 月MVC Design PatternMVC is a widely popular software design pattern, as early as in the70's, IBM introduced the Sanfronscisico on the project, in fact, is the MVC design pattern research. Recently, with the maturity of J2EE, it is becoming a recommendation in the J2EE platform, a design model, the majority of Java developers are also very interested in the design model. MVC model is gradually developed in PHP and ColdFusion are in use, and growth trends. With the rapid increase in web applications, MVC modelfor the development of Web applications is a very advanced design idea, no matter what language you choose, no matter how complicated the application, it can be for you to understand and provide the most basic application model analytical methods, structural products for you toprovide a clear framework for the design, for your software projects in accordance with norms.MVC design ideaMVC in English or Model-View-Controller, an application that is input, process, output process in accordance with the Model, View, Controller isolated manner, such an application is divided into three layers - model layer, view layer, control layer.View (View) on behalf of the user interface for Web applications can be summed up as HTML interface, but has the potential to XHTML, XML, and Applet. With the application of the complexity and scale, the interface has become challenging to deal with. An application may have different views, MVC design pattern to deal with the view of the limited view of data acquisition and processing, as well as the user's request, not included in the view on the handling of business processes. The handling of business processes to the model (Model) to deal with. For example, a view only accept orders from the model data and display to users, as well as input user interface data and the request passed to the control and model.Model (Model): is the business process / status of the processing and business rules. Business process layer is the other black-box operation, the model view to accept the request of the data, and return the results of the final. The design of business models can be said to be the most important core of MVC.Currently popular model of EJB applications is a typical example of the application of technology from the perspective of the model further delineation in order to make full use of existing components, but it can not be used as a framework for application design model. It only tell you that according to the design of this model will be able to use certain technology components, thereby reducing the technical difficulties. Example of a developer, you can focus on business model design. MVC design pattern tells us that the application of the model according to certain rules of taking away the level of extraction is very important, which is to determine whether the development in accordance with good design. Abstract and concrete can not be separated too far, nor too close.MVC model did not provide the design method, but only tell you that the management of these models should be organized in order tofacilitate reconstruction and improve the model reusability. We can make an analogy with object programming, MVC defines a top-level category, the sub-class to tell it you have todo these, but you can not do these restrictions. This is the developer of the programming is very important.There is also a business model of the model is very important that the data model. Data model mainly refers to the object data entities (continued of).For example, an order will be saved to the database, to obtainorders from the database. We can separate this model, all the operation of the database is only. Limited to the model.Control (Controller) can be interpreted as a request received from the user, matching the model and view together to complete the user's request. The role of division of control layer is also very clear that it clearly tell you that it is a distributed, and what kind of model to choose, choose what kind of view, to complete what the user requests. Control layer does not do any data processing. For example, the user clicks on a link and control layer to receive arequest, does not deal with business information, only the user's information to the model, to tell what model to choose the view to meet the requirements to return to the user. Therefore, a model may correspond to multiple views, one view may correspond to a number of models. The benefits of MVC Most of the process of language use such as ASP, PHP developed Web applications, the development of the initial template is the mixed layer of the data programming. For example, send the request directly to the database and display HTML, development speed is often faster, but because of the separation of data pages is not very direct, and therefore reflect the business model difficult to look or model reusability. Very flexible product design efforts, it is difficult to meet the changing needs of users. MVC layered on the application of the requirements, although additional work would take, but clearly thestructure of products, product application through the model can be better reflected.First of all, the most important thing is that there should be a number of view corresponds to the ability of a model. In the current rapidly changing user requirements, it may have access to a wide range of applications. For example, orders for the model may be orders of the system as well as online orders, or orders for other systems, but the handling of orders is the same, that is to say the handling of orders is the same. MVC design pattern in accordance with a orders for models and multiple views can solve the problem. This reduced the code to copy,that is, a reduction of the maintenance code, once the model changes, but also easy to maintain.MVC Design ModelSecondly, the data returned as a result of the model without any display format, so these models can also be directly applied to the use of interfaces.Third, as a result of an application to be separated into three, it is sometimes one of them will be able to change to meet changes in the application.An application of business processes or business rules change simply changes the model layer MVC.The concept of control layer is also very effective, because of its different models and different views together to complete variousrequests, the control layer can be said to be included in the concept of a user request for permission.Finally, it is also beneficial to the management of software engineering. Because each different layer, each layer of different applications have some similar characteristics, is conducive to the adoption of engineering and management tools of program code generated.The shortcomings of MVCDesign and implementation of MVC is not very easy, easier to understand, but for developers the requirements are relatively high. MVC is just a basic designidea, but also the need for careful design and planning.Model and the strict separation of view may make debugging more difficult, but easier to find errors.Experience has shown that, MVC as a result of the application is divided into three, means that the number of code files, so the need for document management. Costs point thought.Above, MVC is a very good software to build a basic model, at least the separation of processing and display, forcing the application is divided into model, view and control layer, making you seriously consider the additional complexity of the application of these ideasinto the structure, an increase of application scalability. If we can grasp this, MVC model will make your application stronger, more flexible and more personalized.MVC设计模型MVC是一种目前广泛流行的软件设计模式,早在70年代,IBM就推出了Sanfronscisico项目计划,其实就是MVC设计模式的研究。

外文文献JSP中英文翻译

外文文献JSP中英文翻译

THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource:Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS)and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex,and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of,any factory can carry out the JSP on own system.The After Sun release the JSP(the Java Server Pages) formally,the this kind of new Web application development technique very quickly caused the peopl e’s concern.JSP provided a special development environment for the Web application that establishes the high dynamic state。

JSP外文文献原稿和译文

JSP外文文献原稿和译文

外文文献原稿和译文原稿JSPJSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML web page document (*. htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*. jsp).Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy.Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function.JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.JSP pages from HTML code and Java code embedded in one of the components. The server was in the pages of client requests after the Java code and then will generate the HTML pages to return to the client browser. Java Servlet JSP is the technical foundation and large-scale Web application development needs of Java Servlet and JSP support tocomplete. JSP with the Java technology easy to use, fully object-oriented, and a platform-independent and secure, mainly for all the characteristics of the Internet.JavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a competing technology; it is a complementary one.It is also possible to use JavaScript on the server, most notably on Sun ONE (formerly iPlanet), IIS, and BroadVision servers. However, Java is more powerful, flexible, reliable, and portable.JSP (a recursive acronym for "JSP: Hypertext Preprocessor") is a free, open-source, HTML-embedded scripting language that is somewhat similar to both ASP and JSP. One advantage of JSP is that the dynamic part is written in Java, which already has an extensive API for networking, database access, distributed objects, and the like, whereas PHP requires learning an entirely new, less widely used language. A second advantage is that JSP is much more widely supported by tool and server vendors than is JSP.Versus Pure Servlets.JSP doesn't provide any capabilities that couldn't, in principle, be accomplished with servlets. In fact, JSP documents are automatically translated into servlets behind the scenes. But it is more convenient to write (and to modify!) regular HTML than to use a zillion println statements to generate the HTML. Plus, by separating the presentation from the content, you can put different people on different tasks: your Web page design experts can build the HTML by using familiar tools and either leave places for your servlet programmers to insert the dynamic content or invoke the dynamic content indirectly by means of XML tags.JSP technology strength(1)time to prepare, run everywhere. At this point Java better than PHP, in addition to systems, the code not to make any changes.(2)the multi-platform support. Basically on all platforms of any development environment, in any environment for deployment in any environment in the expansion. Compared ASP / PHP limitations are obvious.(3) a strong scalability. From only a small Jar documents can run Servlet JSP, to the multiple servers clustering and load balancing, to multiple Application for transaction processing, information processing, a server to numerous servers, Java shows a tremendous Vitality.(4)diversification and powerful development tools support. This is similar to the ASP, Java already have many very good development tools, and many can be free, and many of them have been able to run on a variety of platforms under.JSP technology vulnerable:(1)and the same ASP, Java is the advantage of some of its fatal problem. It is precisely because in order to cross-platform functionality, in order to extreme stretching capacity, greatly increasing the complexity of the product.(2)Java's speed is class to complete the permanent memory, so in some cases by the use of memory compared to the number of users is indeed a "minimum cost performance." On the other hand, it also needs disk space to store a series of. Java documents and. Class, as well as the corresponding versions of documents.Know servlets for four reasons:1.JSP pages get translated into servlets. You can't understand how JSP works without understanding servlets.2.JSP consists of static HTML, special-purpose JSP tags, and Java code. What kind of Java code? Servlet code! You can't write that code if you don't understand servlet programming.3.Some tasks are better accomplished by servlets than by JSP. JSP is good at generating pages that consist of large sections of fairly well structured HTML or other character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve little or no output.4.Some tasks are better accomplished by a combination of servlets and JSP than by either servlets or JSP alone.Versus JavaScriptJavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a competing technology; it is a complementary one.JSP is by no means perfect. Many people have pointed out features that could be improved. This is a good thing, and one of the advantages of JSP is that the specification is controlled by a community that draws from many different companies. So, the technology can incorporate improvements in successive releases.However, some groups have developed alternative Java-based technologies to try to address these deficiencies. This, in our judgment, is a mistake. Using a third-party tool like Apache Struts that augments JSP and servlet technology is a good idea when that tool adds sufficient benefit to compensate for the additional complexity. But using a nonstandard tool that tries to replace JSP is a bad idea. When choosing a technology, you need to weigh many factors: standardization, portability, integration, industry support, and technical features. The arguments for JSP alternatives have focused almost exclusively on the technical features part. But portability, standardization, and integration are also very important. For example, the servlet and JSP specifications define a standard directory structure for Web applications and provide standard files (.war files) for deploying Web applications. All JSP-compatible servers must support these standards. Filters can be set up to apply to any number of servlets or JSP pages, but not to nonstandard resources. The same goes for Web application security settings.JSP six built-in objects:request, response, out, session, application, config, pagecontext, page, exception. ONE.Request for:The object of the package of information submitted by users, by calling the object corresponding way to access the information package, namely the use of the target users can access the information.TWO.Response object:The customer's request dynamic response to the client sent the data.THREE.session object1.What is the session: session object is a built-in objects JSP, it in the first JSP pages loaded automatically create, complete the conversation of management.From a customer to open a browser and connect to the server, to close the browser, leaving the end of this server, known as a conversation. When a customer visits a server, the server may be a few pages link between repeatedly, repeatedly refresh a page, the server should be through some kind of way to know this is the same client, which requires session object.2.session object ID: When a customer's first visit to a server on the JSP pages, JSP engines produce a session object, and assigned a String type of ID number, JSP engine at the same time, the ID number sent to the client, stored in Cookie, this session objects, and customers on the establishment of a one-to-one relationship. When a customer to connect to the server of the other pages, customers no longer allocated to the new session object, until, close your browser, the client-server object to cancel the session, and the conversation, and customer relationship disappeared. When a customer re-open the browser to connect to the server, the server for the customer to create a new session object.FORE.aplication target1.What is the application:Servers have launched after the application object, when a customer to visit the site between the various pages here, this application objects are the same, until the server is down. But with the session difference is that all customers of the application objects are the same, that is, all customers share this built-in application objects.2.application objects commonly used methods:(1)public void setAttribute (String key, Object obj): Object specified parameters will be the object obj added to the application object, and to add the subject of the designation of a keyword index.(2)public Object getAttribute (String key): access to application objects containing keywords for.FIVE.out targetsout as a target output flow, used to client output data. out targets for the output data. SIX.Cookie1.What is Cookie:Cookie is stored in Web server on the user's hard drive section of the text. Cookie allow a Web site on the user's computer to store information on and then get back to it.For example, a Web site may be generated for each visitor a unique ID, and then to Cookie in the form of documents stored in each user's machine.If you use IE browser to visit Web, you will see all stored on your hard drive on the Cookie. They are most often stored in places: c: \ windows \ cookies (in Window2000 is in the C: \ Documents and Settings \ your user name \ Cookies)Cookie is "keyword key = value value" to preserve the format of the record.2.Targets the creation of a Cookie, Cookie object called the constructor can create a Cookie. Cookie object constructor has two string parameters: Cookie Cookie name and value.Cookie c = new Cookie ( "username", "john");3.If the JSP in the package good Cookie object to send to the client, the use of the response.addCookie () method.Format: response.addCookie (c)4.Save to read the client's Cookie, the use of the object request getCookies () method will be implemented in all client came to an array of Cookie objects in the form of order, to meet the need to remove the Cookie object, it is necessary to compare an array cycle Each target keywords.译文JSPJSP(JavaServer Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。

MVC设计模式介绍毕业论文外文翻译

MVC设计模式介绍毕业论文外文翻译

技术简介1.MVC设计模式介绍MVC模式是“ Model-View-controller ”的缩写,中文翻译为“模式-试图-控制器”。

MVC应用程序总是由这三个部分组成。

Event导致Controller改变Model或View, 或者同时改变两者。

只要Controller改变了Models的数据或者属性,所有依赖的View 都会自动更新。

类似的,重要Controller改变了View, View会从潜在的Model中获取数据来刷新自己。

MVC模式最早是Smalltalk语言研究团提岀的,应用于交互应用程序中。

Java语言是而向对象语言,很自然的SUN在应用程序事例中就推荐MVC 模式作为开发Web应用的架构模式。

MVC模式是一种架构模式,英实需要英他模式协作完成。

在J2EE 模式目录中,通常采用service to worker模式是新,而service to worker模式可由集中控制器模式,派遣器模式和Page Helper模式组成。

2. Struts2 简介虽然Struts2号称是一个全新的框架,但这仅仅是相对Struts 1而言。

Struts2与Strutsl 相比,确实有很多革命性的改进,但它并不是新发布的新框架。

从某种程度上来讲,Struts2没有继承Strutsl的血统,而是继承WebWork的血统。

Struts2是WebWork的升级,而不是一个全新的框架,因此稳泄性、性能等各方而都有很好的保证:而且吸收了Strutsl和WebWork两者的优势。

Struts2 Action类可以实现一个Action接口,也可实现其他接口,使可选和定制的服务成为可能。

Struts2提供一个ActionSupport基类去实现常用的接口。

Action接口不是必须的,任何有execute标识的POJO对象都可以用作Struts2的Action对象。

Struts2 Action 对象为每一个请求产生一个实例,因此没有线程安全问题。

JSP软件毕业外文翻译---Struts——MVC 的一种开放源码实现

JSP软件毕业外文翻译---Struts——MVC 的一种开放源码实现

Struts——an open-source MVC implementationBy: Malcolm Davis.Source: Struts--an open-source MVC implementation[J].IBM Systems JournalThis 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 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 professionally 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 in creating a great looking object interface than a user interface. Java Server 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 pattern 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 give 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 issues with the single module approach by dividing the problem into three categories:•ModelThe model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.•View•The 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 knowsnothing about the controller. The view should be notified when changes to the model occur. ControllerThe 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 changes. 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 generate 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 isn't able to have direct involvement in page development.•HTML embedded into code is ugly.For the Web, the classical form of MVC needed to change. Figure 4 displays the Web adaptation of MVC, also commonly known as MVC Model 2 or MVC 2.Figure 4. MVC Model 2Struts, an MVC 2 implementationStruts is a set of cooperating classes, servlets, 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 5 displays an overview of Struts.Figure 5. Struts overviewStruts overview•Client browserAn HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.•ControllerThe Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.•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 business logic.•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.•ViewThe view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like Velocity.Struts detailsDisplayed in Figure 6 is a stripped-down UML diagram of the org.apache.struts.action package. Figure 6 shows the minimal relationships among ActionServlet (Controller), ActionForm (Form State), and Action (Model Wrapper).Figure 6. UML diagram of the relationship of the Command (ActionServlet) to the Model (Action & ActionForm)The ActionServlet classDo you remember the days of function mappings? You would map some input event to a pointer to a function. If you where slick, you would place the configuration information into a file and load the file at run time. Function pointer arrays were the good old days of structured programming in C.Life is better now that we have Java technology, XML, J2EE, and all that. The Struts Controller is a servlet that maps events (an event generally being an HTTP post) to classes. And guess what -- the Controller uses a configuration file so you don_t have to hard-code the values. Life changes, but stays the same.ActionServlet is the Command part of the MVC implementation and is the core of the Framework. ActionServlet (Command) creates and uses Action, an ActionForm, and ActionForward. As mentioned earlier, the struts-config.xml file configures the Command. During the creation of the Web project, Action and ActionForm are extended to solve the specific problem space. The file struts-config.xml instructs ActionServlet on how to use the extended classes. There are several advantages to this approach:•The entire logical flow of the application is in a hierarchical text file. This makes it easier to view and understand, especially with large applications.•The page designer does not have to wade through Java code to understand the flow of the application.•The Java developer does not need to recompile code when making flow changes.Command functionality can be added by extending ActionServlet.The ActionForm classActionForm maintains the session state for the Web application. ActionForm is an abstract class that is sub-classed for each input form model. When I say input form model, I am saying ActionForm represents a general concept of data that is set or updated by a HTMLform. For instance, you may have a UserActionForm that is set by an HTML Form. The Struts framework will:•Check to see if a UserActionForm exists; if not, it will create an instance of the class.•Struts will set the state of the UserActionForm using corresponding fields from the HttpServletRequest. No more dreadful request.getParameter() calls. For instance, the Struts framework will take fname from request stream and call UserActionForm.setFname().•The Struts framework updates the state of the UserActionForm before passing it to the business wrapper UserAction.•Before passing it to the Action class, Struts will also conduct form state validation by calling the validation() method on UserActionForm. Note:This is not always wise to do. There might be ways of using UserActionForm in other pages or business objects, where the validation might be different. Validation of the state might be better in the UserAction class.•The UserActionForm can be maintained at a session level.Notes:•The struts-config.xml file controls which HTML form request maps to which ActionForm.•Multiple requests can be mapped UserActionForm.•UserActionForm can be mapped over multiple pages for things such as wizards.The Action classThe Action class is a wrapper around the business logic. The purpose of Action class is to translate the HttpServletRequest to the business logic. To use Action, subclass and overwrite the process() method.The ActionServlet (Command) passes the parameterized classes to ActionForm using the perform() method. Again, no more dreadful request.getParameter() calls. By the time the event gets here, the input form data (or HTML form data) has already been translated out of the request stream and into an ActionForm class.Note: "Think thin" when extending the Action class. The Action class should control the flow and not the logic of the application. By placing the business logic in a separate package or EJB, we allow flexibility and reuse.Another way of thinking about Action class is as the Adapter design pattern. The purpose of the Action is to "Convert the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn_t otherwise because of incompatibility interface" (from Design Patterns - Elements of Reusable OO Software by Gof). The client in this instance is the ActionServlet that knows nothing about our specific business classinterface. Therefore, Struts provides a business interface it does understand, Action. By extending the Action, we make our business interface compatible with Struts business interface. (An interesting observation is that Action is a class and not an interface. Action started as an interface and changed into a class over time. Nothing's perfect.) The Error classesThe UML diagram (Figure 6) also included ActionError and ActionErrors. ActionError encapsulates an individual error message. ActionErrors is a container of ActionError classes that the View can access using tags. ActionErrors is Struts way of keeping up with a list of errors.Figure 7. UML diagram of the relationship of the Command (ActionServlet) to the Model (Action)The ActionMapping classAn incoming event is normally in the form of an HTTP request, which the servlet Container turns into an HttpServletRequest. The Controller looks at the incoming event and dispatches the request to an Action class. The struts-config.xml determines what Action class the Controller calls. The struts-config.xml configuration information is translated into a set of ActionMapping, which are put into container of ActionMappings. (If you have not noticed it, classes that end with s are containers)The ActionMapping contains the knowledge of how a specific event maps to specific Actions. The ActionServlet (Command) passes the ActionMapping to the Action class via the perform() method. This allows Action to access the information to control flow.ActionMappingsActionMappings is a collection of ActionMapping objects.Struts prosUse of JSP tag mechanismThe tag feature promotes reusable code and abstracts Java code from the JSP file. This feature allows nice integration into JSP-based development tools that allow authoring with tags.•Tag libraryWhy re-invent the wheel, or a tag library? If you cannot find something you need in the library, contribute. In addition, Struts provides a starting point if you are learning JSP tag technology.•Open sourceYou have all the advantages of open source, such as being able to see the code and having everyone else using the library reviewing the code. Many eyes make for great code review.•Sample MVC implementationStruts offers some insight if you want to create your own MVC implementation.•Manage the problem spaceDivide and conquer is a nice way of solving the problem and making the problem manageable. Of course, the sword cuts both ways. The problem is more complex and needs more management.Struts cons•YouthStruts development is still in preliminary form. They are working toward releasing a version 1.0, but as with any 1.0 version, it does not provide all the bells and whistles.•ChangeThe framework is undergoing a rapid amount of change. A great deal of change has occurred between Struts 0.5 and 1.0. You may want to download the most current Struts nightly distributions, to avoid deprecated methods. In the last 6 months, I have seen the Struts library grow from 90K to over 270K. I had to modify my examples several times because of changes in Struts, and I am not going to guarantee my examples will work with the version of Struts you download.•Correct level of abstractionDoes Struts provide the correct level of abstraction? What is the proper level of abstraction for the page designer? That is the $64K question. Should we allow a page designer access to Java code in page development? Some frameworks like Velocity say no, and provide yet another language to learn for Web development. There is some validity to limiting Java code access in UI development. Most importantly, give a page designer a little bit of Java, and he will use a lot of Java. I saw this happen all the time in Microsoft ASP development. In ASP development, you were supposed to create COM objects and then write a little ASP script toglue it all together. Instead, the ASP developers would go crazy with ASP script. I would hear"Why wait for a COM developer to create it when I can program it directly with VBScript?" Struts helps limit the amount of Java code required in a JSP file via tag libraries. One such library is the Logic Tag, which manages conditional generation of output, but this does not prevent the UI developer from going nuts with Java code. Whatever type of framework you decide to use, you should understand the environment in which you are deploying and maintaining the framework. Of course, this task is easier said than done.•Limited scopeStruts is a Web-based MVC solution that is meant be implemented with HTML, JSP files, and servlets.•J2EE application supportStruts requires a servlet container that supports JSP 1.1 and Servlet 2.2 specifications. This alone will not solve all your install issues, unless you are using Tomcat 3.2. I have had a great deal of problems installing the library with Netscape iPlanet 6.0, which is supposedly the first J2EE-compliant application server. I recommend visiting the Struts User Mailing List archive (see Resources) when you run into problems.•ComplexitySeparating the problem into parts introduces complexity. There is no question that some education will have to go on to understand Struts. With the constant changes occurring, this can be frustrating at times. Welcome to the Web.•Where is...I could point out other issues, for instance, where are the client side validations, adaptable workflow, and dynamic strategy pattern for the controller? However, at this point, it is too easy to be a critic, and some of the issues are insignificant, or are reasonable for a 1.0 release. The way the Struts team goes at it, Struts might have these features by the time you read this article, or soon after.Future of StrutsThings change rapidly in this new age of software development. In less than 5 years, I have seen things go from cgi/perl, to ISAPI/NSAPI, to ASP with VB, and now Java and J2EE. Sun is working hard to adapt changes to the JSP/servlet architecture, just as they have in the past with the Java language and API. You can obtain drafts of the new JSP 1.2 and Servlet 2.3 specifications from the Sun Web site. Additionally, a standard tag library for JSP files is appearing.Struts——MVC 的一种开放源码实现作者:Malcolm Davis来源:Struts--an open-source MVC implementation[J]. IBM Systems本文介绍Struts,它是使用servlet 和JavaServer Pages 技术的一种Model-View-Controller 实现。

网上商城系统毕业设计外文翻译

网上商城系统毕业设计外文翻译

毕业设计说明书英文文献及中文翻译班级:学号:姓名:学院:专业:指导教师:1 Struts Framework Based on MVCIn the traditional Web application, Java Server Pages(JSP) pages are responsible for handling all things, for example, receiving requests, executing business logics, choosingthe next page. These complicated things may lead to chaos of JSP pages’ codes and be harmful for the extension and maintenance of pages. The Model-View-Controller (MVC) mode separates the programming codes into three different areas, which has solved the above problem. MVC can realize J2EE application system's stratification and the loose coupling of three layers or multilayer, and it is a realization way of orienting dynamic content. The MVC mode divides application into three core components of Model, View and Controller.Struts is a realization of MVC. It is an open source Web application framework and uses Servlet and JSP marks that belong to the J2EE norm as a part of the realization. Struts inherits MVC characteristics and realizes some corresponding changes and extension according to J2EE traits. Struts separates Java codes of JSP by Java Bean and Action class to be the MVC mode, transmits data among the three partitions of Model, View and Controller, demonstrates the connection between various classes and JSP pages by configuration files finally and it intends to realize the separation of presentation layer, business layer and data layer. The Struts structure is shown in Figure 1.The Model contains the business logic that exchanges data with a persistence layer. The View is in charge of producing what is directly visible to the user, . web pages. The Controller is the layer that receives requests from clients, determines what business logic takes place and where to go next. In the Struts framework, the Model uses Java classes for the business logic. The View can be implemented with JSP and the Tag lib of Struts. The Controller is a J2EE component known as Servlet, more specifically an ActionServlet object, which determines what or when logic gets executed and where the control should get directed.2 Hibernate Framework Based on ORMWorking with both the object-oriented software and the relational database is a complicated task with Java Database Connectivity (JDBC) because there is mismatch between how data is represented in objects versus relational database. So with JDBC, developers have to write pure the Structured Query Languag (SQL) statements to map an object model's data representation to a relational data model and its corresponding database schema.Introduction of HibernateHibernate is a flexible and powerful Object-Relational Mapping (ORM) solution to map Java classes to database tables. It is a powerful, high performance object-relational persistence and query service. Hibernate allows developers to express queries in its own portable SQL extension (Hibernate Query Language (HQL))[3], as well as in native SQL, or with an object-oriented criteria and example Application Programming Interface(API). Hibernate itself takes care of this mapping using XML files so developers don’t need to write code for this.Hibernate is an open source and it is free to use for both development and production deployments, which is a bridge between Java application and relational database and takes charge of mapping between Java objects and relational data. The inside of Hibernate packs the operation of accessing database by JDBC, which provides API of object-oriented database access to upper layer application. So developers can use the object programming thought to operate database sufficiently, caring for the bottom database structure unnecessarily.Hibernate relieves the developer from 95 percent of common data persistence related programming tasks, compared to manual coding with SQL and the JDBC API[4]. And it can integrate various Web server or application server, and nearly support all popular databases server.Principle of HibernateAs shown in figure , Hibernate lies in the middle layer that is between applicationand database .In the provided persistent service, Hibernate maps class to rows of datasheet by properties and mapping files of class itself. Application interacts with database by Persitstent Object (PO) to handle data directly.ApplicationPersistent ObjectsHibernateHibernate.properties XML.MappingDatabaseFigure Hibernate systematic structure3 The Integration of Struts and HibernateIn the open source frameworks, for the presentation part, Tapestry has the powerful and natural combination of pages, its document is too conceptional to benefit programming. And its learning curve was too steep and so on. For the logic part, Spring has a good integration function, but there is a lack of public controller. And EJB depends on the EJB containers, at the same time, it is realized complicatedly. While Struts has been applied extensively because of its advantages.At present, most of systems apply the relational databases mainly, while Java is an object-oriented language essentially. In Model part of Struts framework application, using SQL and JDBC to operate databases when storing and fetching objects reduces programming efficiency and the systematic maintainability. Traditional J2EE-based application applies heavyweight framework based on EJB that adapts to the large enterprise development, while development and debugging by EJB container need to consume a plenty of time and high price. EJB3 improves the disadvantages of original EJB, but its application is not mature yet.Hibernate can substitute Container-Managed Persistence (CMP) to accomplish heavy responsibility of permanence in J2EE framework of applying a word, Hibernate can resolve the difficulties coming from using traditional CMP, JDBC and Data Access Object(DAO) in a technological development. For reducing the coupling of code and raising systematic development efficiency, this paper suggests J2EE application development tactics based on Struts and Hibernate.The Struts design shows the MVC framework sufficiently, which all control flows need a configuration file to manage, and which is convenient to maintain. The integration of Struts and Hibernate is that Hibernate solves the model layer of Struts, which makes developers operate Java objects instead of database. The integration shows the object-oriented thought sufficiently and solves some problems of the database operation in traditional J2EE well.Flow of FrameworkThe flow of integration framework based on Struts and Hibernate is shown in Figure 3. At first, users send Http requests by Browser, then Http requests are accepted by ActionServlet of the control component in business layer, then gave to RequestProcessor which gets corresponding Action from ActionMapping by request URL[3]. Besides, ActionForm packs JSP pages, which can make a checking to data of datasheet if it is needed, send back ActionErrors to visual pages if there are mistakes and transfer the data of pages to Action if it passes validation.Request Processor transfers the “execute” method of Action and the method transfers the business logic module. Hibernate accomplishes interaction of databases and JavaBean. The operation of processing business logic interacts with database by data permanence layer and field object layer. The “execute” method of Action will return ActionForward objects that are accepted by ActionServlet after executing.Systematic Structure of the Integration FrameworkThe EIS layer of the multi-layer J2EE systematic structure can be partitioned into the data permanence layer and the data resource layer. It means a system can be divided into five layers as a whole.Client Layer: This layer runs in the Browser of users’ machin es and handles interaction with users, transmits and shows messages to users. J2EE platform supports different type users including HTML users, Java Applets, Java application, etc.Presentation Layer: This layer works in J2EE Web container, produces the systematic representation logic, handles users’ requests and makes the responses. The entire Web is built on Struts framework, in which the View component is composed of JSP/HTML pages whose data is expressed by ActionForm Bean, the Controller component is composed of ActionServlet united and Action Classes, and the Model component is realized by business logic Logic Layer: This layer accomplishes the required business of system, provides the required business method to presentation layer. It can receive data from client programs and save them to the storage equipment after proper disposal, read data from the data storage equipment, then send them out to client programs.1 基于MVC的Struts框架在传统的Web应用程序,Java服务器页面(JSP)页面负责处理所有的事情,例如,接收请求,执行业务逻辑,选择下一个页面。

JSP技术概述与应用框架外文翻译毕业设计

JSP技术概述与应用框架外文翻译毕业设计
国际化:使JSP应用能够适应不同 国家和地区的语言和文化环境
国际化与本地化的重要性:提高 用户体验,增强市场竞争力
添加标题
添加标题
添加标题
添加标题
本地化:根据不同国家和地区的 语言和文化环境,对JSP应用进行 定制和优化
国际化与本地化的实现方法:使 用国际化框架,如i18n,进行国 际化和本地化处理
翻译质量要求
准确性:确保翻译内容与原文意思一致,无错译、漏译现象 流畅性:翻译语言通顺,符合目标语言的表达习惯 专业性:翻译内容涉及专业术语,需准确翻译,不得随意更改 格式规范:翻译后的文档格式应与原文保持一致,包括字体、字号、行距等
PART 6
毕业设计流程与规范
选题与开题报告撰写
选题:选择与专 业相关的课题, 确保具有研究价 值和实际意义
特点:Spring MVC具有清晰的分层结构,易于扩展和维护,支持RESTful风格,支持 多种视图技术。
核心组件:Spring MVC的核心组件包括DispatcherServlet、HandlerMapping、 Controller、ViewResolver等。
应用场景:Spring MVC广泛应用于Web开发中,如企业级应用、电子商务、社交网站等。
JSP可以与其他 Java技术(如 Servlet、 JDBC、JNDI等) 无缝集成,实现 强大的Web应 用程序开发。
JSP工作原理
JSP是一种服务器端的Java技术,用于创 建动态网页。
JSP页面由HTML、Java代码和JSP标签组 成。
JSP页面在服务器上被编译成Java Servlet,然后由Servlet引擎执行。
翻译质量:准色等
翻译时间:根据毕业设计进度, 合理安排翻译时间

探究ASP.NET MVC 毕业论文 外文翻译中英文对照

探究ASP.NET MVC 毕业论文 外文翻译中英文对照

MVC In-Depth: The Life of an MVC RequestThe purpose of this blog entry is to describe, in painful detail, each step in the life of an MVC request from birth to death. I want to understand everything that happens when you type a URL in a browser and hit the enter key when requesting a page from an MVC website. Why do I care? There are two reasons. First, one of the promises of MVC is that it will be a very extensible framework. For example, you’ll be able to plug in different view engines to control how your website content is rendered. You also will be able to manipulate how controllers get generated and assigned to particular requests. I want to walk through the steps involved in an MVC page request because I want to discover any and all of these extensibility points. Second, I’m interested in Test-Driven Development. In order to write unit tests for controllers, I need to understand all of the controller dependencies. When writing my tests, I need to mockce rtain objects using a mocking framework such as Typemock Isolator or Rhino Mocks. If I don’t understand the page request lifecycle, I won’t be able to effectively mock it.Two WarningsBut first, two warnings.Here's the first warning: I’m writing this blo g entry a week after the MVC Preview 2 was publicly released. The MVC framework is still very much in Beta. Therefore, anything that I describe in this blog entry might be outdated and, therefore, wrong in a couple of months. So, if you are reading this blog entry after May 2008, don’t believe everything you read. Second, this blog entry is not meant as an overview of MVC. I describe the lifecycle of an MVC request in excruciating and difficult to read detail. Okay, you have been warned.Overview of the Lifecycle StepsThere are five main steps that happen when you make a request from an MVC website: 1. Step 1 – The RouteTable is CreatedThis first step happens only once when an application first starts. The RouteTable maps URLs to handlers.2. Step 2 – The UrlRoutingModule Intercepts the RequestThis second step happens whenever you make a request. The UrlRoutingModule intercepts every request and creates and executes the right handler.3. Step 3 – The MvcHandler ExecutesThe MvcHandler creates a controller, passes the controller a ControllerContext, and executes the controller.4. Step 4 – The Controller ExecutesThe controller determines which controller method to execute, builds a list of parameters, and executes the method.5. Step 5 – The RenderView Method is CalledTypically, a controller method calls RenderView() to render content back to the browser. The Controller.RenderView() method delegates its work to a particular ViewEngine.Let’s examine each of th ese steps in detail.Step 1 : The RouteTable is CreatedWhen you request a page from a normal application, there is a page on disk that corresponds to each page request. For example, if you request a page named SomePage.aspx thenthere better be a page named SomePage.aspx sitting on your web server. If not, you receive an error.Technically, an page represents a class. And, not just any class. An page is a handler. In other words, an page implements the IHttpHandler interface and has a ProcessRequest() method that gets called when you request the page. The ProcessRequest() method is responsible for generating the content that gets sent back to the browser.So, the way that a normal application works is simple and intuitive. You request a page, the page request corresponds to a page on disk, the page executes its ProcessRequest() method and content gets sent back to the browser.An MVC application does not work like this. When you request a page from an MVC application, there is no page on disk that corresponds to the request. Instead, the request is routed to a special class called a controller. The controller is responsible for generating the content that gets sent back to the browser.When you write a normal application, you build a bunch of pages. There is always a one-to-one mapping between URLs and pages. Corresponding to each page request, there better be a page.When you build an MVC application, in contrast, you build a bunch of controllers. The advantage of using controllers is that you can have a many-to-one mapping between URLs and pages. For example, all of the following URLs can be mapped to the same controller:The single controller mapped to these URLs can display product information for the right product by extracting the product Id from the URL. The controller approach is more flexible than the classic approach. The controller approach also results in more readable and intuitive URLs.So, how does a particular page request get routed to a particular controller? An MVC application has something called a Route Table. The Route Table maps particular URLs to particular controllers.An application has one and only one Route Table. This Route Table is setup in the Global.asax file. Listing 1 contains the default Global.asax file that you get when you create a new MVC Web Application project by using Visual Studio.An application’s Route Table is represented by the static RouteTable.Routes property. This property represents a collection of Route objects. In the Global.asax file in Listing 1, two Route objects are added to the Route Table when the application first starts (The Application_Start() method is called only once when the very first page is requested from a website).A Route object is responsible for mapping URLs to handlers. In Listing 1, two Route objects are created. Both Route objects map URLs to the MvcRouteHandler. The first Route maps any URL that follows the pattern {controller}/{action}/{id} to the MvcRouteHandler. The second Route maps the particular URL Default.aspx to the MvcRouteHandler.By the way, this new routing infrastructure can be used independently of an MVC application. The Global.asax file maps URLs to the MvcRouteHandler. However, you have the option of routing URLs to a different type of handler. The routing infrastructure described in this section is contained in a distinct assembly named System.Web.Routing.dll. You can use the routing without using the MVC.Step 2 : The UrlRoutingModule Intercepts the RequestWhenever you make a request against an MVC application, the request is interceptedby the UrlRoutingModule HTTP Module. An HTTP Module is a special type of class that participates in each and every page request. For example, classic includes a FormsAuthenticationModule HTTP Module that is used to implement page access security using Forms Authentication.When the UrlRoutingModule intercepts a request, the first thing the module does is to wrap up the current HttpContext in an HttpContextWrapper2 object. The HttpContextWrapper2 class, unlike the normal HttpContext class, derives from the HttpContextBase class. Creating a wrapper for HttpContext makes it easier to mock the class when you are using a Mock Object Framework such as Typemock Isolator or Rhino Mocks.Next, the module passes the wrapped HttpContext to the RouteTable that was setup in the previous step. The HttpContext includes the URL, form parameters, query string parameters, and cookies associated with the current request. If a match can be made between the current request and one of the Route objects in the Route Table, then a RouteData object is returned.If the UrlRoutingModule successfully retrieves a RouteData object then the module next creates a RouteContext object that represents the current HttpContext and RouteData. The module then instantiates a new HttpHandler based on the RouteTable and passes the RouteContext to the new handler’s constructor.In the case of an MVC application, the handler returned from the RouteTable will always be an MvcHandler (The MvcRouteHandler returns an MvcHandler). Whenever the UrlRoutingModule can match the current request against a Route in the Route Table, an MvcHandler is instantiated with the current RouteContext.The last step that the module performs is setting the MvcHandler as the current HTTP Handler.An application calls the ProcessRequest() method automatically on the current HTTP Handler which leads us to the next step.Step 3 : The MvcHandler ExecutesIn the previous step, an MvcHandler that represents a particular RouteContext was set as the current HTTP Handler. An application always fires off a certain series of events including Start, BeginRequest, PostResolveRequestCache, PostMapRequestHandler, PreRequestHandlerExecute, and EndRequest events (there are a lot of application events – for a complete list, lookup the HttpApplication class in the Microsoft Visual Studio 2008 Documentation).Everything described in the previous section happens during the PostResolveRequestCache and PostMapRequestHandler events. The ProcessRequest() method is called on the current HTTP Handler right after the PreRequestHandlerExecute event.When ProcessRequest() is called on the MvcHandler object created in the previous section, a new controller is created. The controller is created from a ControllerFactory. This is an extensibility point since you can create your own ControllerFactory. The default ControllerFactory is named, appropriately enough, DefaultControllerFactory.The RequestContext and the name of the controller are passed to theControllerFactory.CreateController() method to get a particular controller. Next, a ControllerContext object is constructed from the RequestContext and the controller. Finally, the Execute() method is called on the controller class. The ControllerContext is passed to the Execute() method when the Execute() method is called.Step 4 : The Controller ExecutesThe Execute() method starts by creating the TempData object (called the Flash object in the Ruby on Rails world). The TempData can be used to store temporary data that must be used with the very next request (TempData is like Session State with no long-term memory).Next, the Execute() method builds a list of parameters from the request. These parameters, extracted from the request parameters, will act as method parameters. The parameters will be passed to whatever controller method gets executed.The Execute() method finds a method of the controller to execute by using reflection on the controller class (.NET reflection and not navel gazing reflection). The controller class is something that you wrote. So the Execute() method finds one of the methods that you wrote for your controller class and executes it. The Execute() method will not execute any controller methods that are decorated with the NonAction attribute.At this point in the lifecycle, we’ve entered your application code.Step 5 : The RenderView Method is CalledNormally, your controller methods end with a call to either the RenderView() or RedirectToAction() method. The RenderView() method is responsible for rendering a view (a page) to the browser.When you call a controller’s RenderView() method, the call is delegated to the current ViewEngine’s RenderView() method. The ViewEngine is another extensibility point. The default ViewEngine is the WebFormViewEngine. However, you can use another ViewEngine such as the NHaml ViewEngine.The WebFormViewEngine.RenderView() method uses a class named the ViewLocator class to find the view. Next, it uses a BuildManager to create an instance of a ViewPage class from its path. Next, if the page has a master page, the location of the master page is set (again, using the ViewLocator class). If the page has ViewData, the ViewData is set. Finally, the RenderView() method is called on the ViewPage.The ViewPage class derives from the base System.Web.UI.Page class. This is the same class that is used for pages in classic . The final action that RenderView() method performs is to call ProcessRequest() on the page class. Calling ProcessRequest() generates content from the view in the same way that content is generated from a normal page.Extensibility PointsThe MVC lifecycle was designed to include a number of extensibility points. These are points where you can customize the behavior of the framework by plugging in a custom class or overriding an existing class. Here’s a summary of these extensibility points:1. Route objects – When you build the Route Table, you call the RouteCollection.Add() method to add new Route objects. The Add() method accepts a RouteBase object. You can implement your own Route objects that inherit from the base RouteBase class.2. MvcRouteHandler – When building an MVC application, you map URLs to MvcRouteHandler objects. However, you can map a URL to any class that implements the IRouteHandler interface. The constructor for the Route class accepts any object that implements the IRouteHandler interface.3. MvcRouteHandler.GetHttpHandler() – The GetHttpHandler() method of the MvcRouteHandler class is a virtual method. By default, an MvcRouteHandler returns an MvcHandler. If you prefer, you can return a different handler by overriding the GetHttpHandler() method.4. ControllerFactory – You can assign a custom class by calling theSystem.Web.MVC.ControllerBuilder.Current.SetControllerFactory() method to create a custom controller factory. The controller factory is responsible for returning controllers for a given controller name and RequestContext.5. Controller – You can implement a custom controller by implementing the IController interface. This interface has a single method: Execute(ControllerContext controllerContext).6. ViewEngine – You can assign a custom ViewEngine to a controller. You assign a ViewEngine to a controller by assigning a ViewEngine to the public Controller.ViewEngine property. A ViewEngine must implement the IViewEngine interface which has a single method: RenderView(ViewContext viewContext).7. ViewLocator – The ViewLocator maps view names to the actual view files. You can assign a custom ViewLocator to the default WebFormViewEngine.ViewLocator property.If you can think of any other extensibility points that I overlooked, please add a comment to this blog post and I will update this entry.SummaryThe goal of this blog entry was to describe the entire life of an MVC request from birth to death. I examined the five steps involved in processing an MVC request: Creating the RouteTable, Intercepting the request with the UrlRoutingModule, Generating a Controller, Executing an Action, and Rendering a View. Finally, I talked about the points at which the MVC Framework can be extended.探究 MVC: MVC请求的生命周期本书详细描述了 MVC请求从开始到结束的整个过程,当你在浏览器上输入URL地址并且在网站请求页面敲击回车时,这个过程就产生了。

毕业设计论文外文文献翻译

毕业设计论文外文文献翻译

xxxx大学xxx学院毕业设计(论文)外文文献翻译系部xxxx专业xxxx学生姓名xxxx 学号xxxx指导教师xxxx 职称xxxx2013年3 月Introducing the Spring FrameworkThe Spring Framework: a popular open source application framework that addresses many of the issues outlined in this book. This chapter will introduce the basic ideas of Spring and dis-cuss the central “bean factory” lightweight Inversion-of-Control (IoC) container in detail.Spring makes it particularly easy to implement lightweight, yet extensible, J2EE archi-tectures. It provides an out-of-the-box implementation of the fundamental architectural building blocks we recommend. Spring provides a consistent way of structuring your applications, and provides numerous middle tier features that can make J2EE development significantly easier and more flexible than in traditional approaches.The basic motivations for Spring are:To address areas not well served by other frameworks. There are numerous good solutions to specific areas of J2EE infrastructure: web frameworks, persistence solutions, remoting tools, and so on. However, integrating these tools into a comprehensive architecture can involve significant effort, and can become a burden. Spring aims to provide an end-to-end solution, integrating spe-cialized frameworks into a coherent overall infrastructure. Spring also addresses some areas that other frameworks don’t. For example, few frameworks address generic transaction management, data access object implementation, and gluing all those things together into an application, while still allowing for best-of-breed choice in each area. Hence we term Spring an application framework, rather than a web framework, IoC or AOP framework, or even middle tier framework.To allow for easy adoption. A framework should be cleanly layered, allowing the use of indi-vidual features without imposing a whole worldview on the application. Many Spring features, such as the JDBC abstraction layer or Hibernate integration, can be used in a library style or as part of the Spring end-to-end solution.To deliver ease of use. As we’ve noted, J2EE out of the box is relatively hard to use to solve many common problems. A good infrastructure framework should make simple tasks simple to achieve, without forcing tradeoffs for future complex requirements (like distributed transactions) on the application developer. It should allow developers to leverage J2EE services such as JTA where appropriate, but to avoid dependence on them in cases when they are unnecessarily complex.To make it easier to apply best practices. Spring aims to reduce the cost of adhering to best practices such as programming to interfaces, rather than classes, almost to zero. However, it leaves the choice of architectural style to the developer.Non-invasiveness. Application objects should have minimal dependence on the framework. If leveraging a specific Spring feature, an object should depend only on that particular feature, whether by implementing a callback interface or using the framework as a class library. IoC and AOP are the key enabling technologies for avoiding framework dependence.Consistent configuration. A good infrastructure framework should keep application configuration flexible and consistent, avoiding the need for custom singletons and factories. A single style should be applicable to all configuration needs, from the middle tier to web controllers.Ease of testing. Testing either whole applications or individual application classes in unit tests should be as easy as possible. Replacing resources or application objects with mock objects should be straightforward.To allow for extensibility. Because Spring is itself based on interfaces, rather than classes, it is easy to extend or customize it. Many Spring components use strategy interfaces, allowing easy customization.A Layered Application FrameworkChapter 6 introduced the Spring Framework as a lightweight container, competing with IoC containers such as PicoContainer. While the Spring lightweight container for JavaBeans is a core concept, this is just the foundation for a solution for all middleware layers.Basic Building Blockspring is a full-featured application framework that can be leveraged at many levels. It consists of multi-ple sub-frameworks that are fairly independent but still integrate closely into a one-stop shop, if desired. The key areas are:Bean factory. The Spring lightweight IoC container, capable of configuring and wiring up Java-Beans and most plain Java objects, removing the need for custom singletons and ad hoc configura-tion. Various out-of-the-box implementations include an XML-based bean factory. The lightweight IoC container and its Dependency Injection capabilities will be the main focus of this chapter.Application context. A Spring application context extends the bean factory concept by adding support for message sources and resource loading, and providing hooks into existing environ-ments. Various out-of-the-box implementations include standalone application contexts and an XML-based web application context.AOP framework. The Spring AOP framework provides AOP support for method interception on any class managed by a Spring lightweight container.It supports easy proxying of beans in a bean factory, seamlessly weaving in interceptors and other advice at runtime. Chapter 8 dis-cusses the Spring AOP framework in detail. The main use of the Spring AOP framework is to provide declarative enterprise services for POJOs.Auto-proxying. Spring provides a higher level of abstraction over the AOP framework and low-level services, which offers similar ease-of-use to .NET within a J2EE context. In particular, the provision of declarative enterprise services can be driven by source-level metadata.Transaction management. Spring provides a generic transaction management infrastructure, with pluggable transaction strategies (such as JTA and JDBC) and various means for demarcat-ing transactions in applications. Chapter 9 discusses its rationale and the power and flexibility that it offers.DAO abstraction. Spring defines a set of generic data access exceptions that can be used for cre-ating generic DAO interfaces that throw meaningful exceptions independent of the underlying persistence mechanism. Chapter 10 illustrates the Spring support for DAOs in more detail, examining JDBC, JDO, and Hibernate as implementation strategies.JDBC support. Spring offers two levels of JDBC abstraction that significantly ease the effort of writing JDBC-based DAOs: the org.springframework.jdbc.core package (a template/callback approach) and the org.springframework.jdbc.object package (modeling RDBMS operations as reusable objects). Using the Spring JDBC packages can deliver much greater pro-ductivity and eliminate the potential for common errors such as leaked connections, compared with direct use of JDBC. The Spring JDBC abstraction integrates with the transaction and DAO abstractions.Integration with O/R mapping tools. Spring provides support classesfor O/R Mapping tools like Hibernate, JDO, and iBATIS Database Layer to simplify resource setup, acquisition, and release, and to integrate with the overall transaction and DAO abstractions. These integration packages allow applications to dispense with custom ThreadLocal sessions and native transac-tion handling, regardless of the underlying O/R mapping approach they work with.Web MVC framework. Spring provides a clean implementation of web MVC, consistent with the JavaBean configuration approach. The Spring web framework enables web controllers to be configured within an IoC container, eliminating the need to write any custom code to access business layer services. It provides a generic DispatcherServlet and out-of-the-box controller classes for command and form handling. Request-to-controller mapping, view resolution, locale resolution and other important services are all pluggable, making the framework highly extensi-ble. The web framework is designed to work not only with JSP, but with any view technology, such as Velocity—without the need for additional bridges. Chapter 13 discusses web tier design and the Spring web MVC framework in detail.Remoting support. Spring provides a thin abstraction layer for accessing remote services without hard-coded lookups, and for exposing Spring-managed application beans as remote services. Out-of-the-box support is inc luded for RMI, Caucho’s Hessian and Burlap web service protocols, and WSDL Web Services via JAX-RPC. Chapter 11 discusses lightweight remoting.While Spring addresses areas as diverse as transaction management and web MVC, it uses a consistent approach everywhere. Once you have learned the basic configuration style, you will be able to apply it in many areas. Resources, middle tier objects, and web components are all set up using the same bean configuration mechanism. You can combine your entireconfiguration in one single bean definition file or split it by application modules or layers; the choice is up to you as the application developer. There is no need for diverse configuration files in a variety of formats, spread out across the application.Spring on J2EEAlthough many parts of Spring can be used in any kind of Java environment, it is primarily a J2EE application framework. For example, there are convenience classes for linking JNDI resources into a bean factory, such as JDBC DataSources and EJBs, and integration with JTA for distributed transaction management. In most cases, application objects do not need to work with J2EE APIs directly, improving reusability and meaning that there is no need to write verbose, hard-to-test, JNDI lookups.Thus Spring allows application code to seamlessly integrate into a J2EE environment without being unnecessarily tied to it. You can build upon J2EE services where it makes sense for your application, and choose lighter-weight solutions if there are no complex requirements. For example, you need to use JTA as transaction strategy only if you face distributed transaction requirements. For a single database, there are alternative strategies that do not depend on a J2EE container. Switching between those transac-tion strategies is merely a matter of configuration; Spring’s consistent abstraction avoids any need to change application code.Spring offers support for accessing EJBs. This is an important feature (and relevant even in a book on “J2EE without EJB”) because the u se of dynamic proxies as codeless client-side business delegates means that Spring can make using a local stateless session EJB an implementation-level, rather than a fundamen-tal architectural, choice.Thus if you want to use EJB, you can within a consistent architecture; however, you do not need to make EJB the cornerstone of your architecture. This Spring feature can make devel-oping EJB applications significantly faster, because there is no need to write custom code in service loca-tors or business delegates. Testing EJB client code is also much easier, because it only depends on the EJB’s Business Methods interface (which is not EJB-specific), not on JNDI or the EJB API.Spring also provides support for implementing EJBs, in the form of convenience superclasses for EJB implementation classes, which load a Spring lightweight container based on an environment variable specified in the ejb-jar.xml deployment descriptor. This is a powerful and convenient way of imple-menting SLSBs or MDBs that are facades for fine-grained POJOs: a best practice if you do choose to implement an EJB application. Using this Spring feature does not conflict with EJB in any way—it merely simplifies following good practice.Introducing the Spring FrameworkThe main aim of Spring is to make J2EE easier to use and promote good programming practice. It does not reinvent the wheel; thus you’ll find no logging packages in Spring, no connection pools, no distributed transaction coordinator. All these features are provided by other open source projects—such as Jakarta Commons Logging (which Spring uses for all its log output), Jakarta Commons DBCP (which can be used as local DataSource), and ObjectWeb JOTM (which can be used as transaction manager)—or by your J2EE application server. For the same reason, Spring doesn’t provide an O/R mapping layer: There are good solutions for this problem area, such as Hibernate and JDO.Spring does aim to make existing technologies easier to use. For example, although Spring is not in the business of low-level transactioncoordination, it does provide an abstraction layer over JTA or any other transaction strategy. Spring is also popular as middle tier infrastructure for Hibernate, because it provides solutions to many common issues like SessionFactory setup, ThreadLocal sessions, and exception handling. With the Spring HibernateTemplate class, implementation methods of Hibernate DAOs can be reduced to one-liners while properly participating in transactions.The Spring Framework does not aim to replace J2EE middle tier services as a whole. It is an application framework that makes accessing low-level J2EE container ser-vices easier. Furthermore, it offers lightweight alternatives for certain J2EE services in some scenarios, such as a JDBC-based transaction strategy instead of JTA when just working with a single database. Essentially, Spring enables you to write appli-cations that scale down as well as up.Spring for Web ApplicationsA typical usage of Spring in a J2EE environment is to serve as backbone for the logical middle tier of a J2EE web application. Spring provides a web application context concept, a powerful lightweight IoC container that seamlessly adapts to a web environment: It can be accessed from any kind of web tier, whether Struts, WebWork, Tapestry, JSF, Spring web MVC, or a custom solution.The following code shows a typical example of such a web application context. In a typical Spring web app, an applicationContext.xml file will reside in the WEB-INF directory, containing bean defini-tions according to the “spring-beans” DTD. In such a bean definition XML file, business objects and resources are defined, for example, a “myDataSource” bean, a “myInventoryManager” bean, and a “myProductManager” bean. Spring takes care of their configuration, their wiring up, and their lifecycle.<beans><bean id=”myDataSource” class=”org.springframework.jdbc. datasource.DriverManagerDataSource”><property name=”driverClassName”> <value>com.mysql.jdbc.Driver</value></property> <property name=”url”><value>jdbc:mysql:myds</value></property></bean><bean id=”myInventoryManager” class=”ebusiness.DefaultInventoryManager”> <property name=”dataSource”><ref bean=”myDataSource”/> </property></bean><bean id=”myProductManager” class=”ebusiness.DefaultProductManage r”><property name=”inventoryManager”><ref bean=”myInventoryManager”/> </property><property name=”retrieveCurrentStock”> <value>true</value></property></bean></beans>By default, all such beans have “singleton” scope: one instance per context. The “myInventoryManager” bean will automatically be wired up with the defined DataSource, while “myProductManager” will in turn receive a reference to the “myInventoryManager” bean. Those objects (traditionally called “beans” in Spring terminology) need to expos e only the corresponding bean properties or constructor arguments (as you’ll see later in this chapter); they do not have to perform any custom lookups.A root web application context will be loaded by a ContextLoaderListener that is defined in web.xml as follows:<web-app><listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>...</web-app>After initialization of the web app, the root web application context will be available as a ServletContext attribute to the whole web application, in the usual manner. It can be retrieved from there easily via fetching the corresponding attribute, or via a convenience method in org.springframework.web. context.support.WebApplicationContextUtils. This means that the application context will be available in any web resource with access to the ServletContext, like a Servlet, Filter, JSP, or Struts Action, as follows:WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);The Spring web MVC framework allows web controllers to be defined as JavaBeans in child application contexts, one per dispatcher servlet. Such controllers can express dependencies on beans in the root application context via simple bean references. Therefore, typical Spring web MVC applications never need to perform a manual lookup of an application context or bean factory, or do any other form of lookup.Neither do other client objects that are managed by an application context themselves: They can receive collaborating objects as bean references.The Core Bean FactoryIn the previous section, we have seen a typical usage of the Spring IoC container in a web environment: The provided convenience classes allow for seamless integration without having to worry about low-level container details. Nevertheless, it does help to look at the inner workings to understand how Spring manages the container. Therefore, we will now look at the Spring bean container in more detail, starting at the lowest building block: the bean factory. Later, we’ll continue with resource setup and details on the application context concept.One of the main incentives for a lightweight container is to dispense with the multitude of custom facto-ries and singletons often found in J2EE applications. The Spring bean factory provides one consistent way to set up any number of application objects, whether coarse-grained components or fine-grained busi-ness objects. Applying reflection and Dependency Injection, the bean factory can host components that do not need to be aware of Spring at all. Hence we call Spring a non-invasive application framework.Fundamental InterfacesThe fundamental lightweight container interface is org.springframework.beans.factory.Bean Factory. This is a simple interface, which is easy to implement directly in the unlikely case that none of the implementations provided with Spring suffices. The BeanFactory interface offers two getBean() methods for looking up bean instances by String name, with the option to check for a required type (and throw an exception if there is a type mismatch).public interface BeanFactory {Object getBean(String name) throws BeansException;Object getBean(String name, Class requiredType) throws BeansException;boolean containsBean(String name);boolean isSingleton(String name) throws NoSuchBeanDefinitionException;String[] getAliases(String name) throws NoSuchBeanDefinitionException;}The isSingleton() method allows calling code to check whether the specified name represents a sin-gleton or prototype bean definition. In the case of a singleton bean, all calls to the getBean() method will return the same object instance. In the case of a prototype bean, each call to getBean() returns an inde-pendent object instance, configured identically.The getAliases() method will return alias names defined for the given bean name, if any. This mecha-nism is used to provide more descriptive alternative names for beans than are permitted in certain bean factory storage representations, such as XML id attributes.The methods in most BeanFactory implementations are aware of a hierarchy that the implementation may be part of. If a bean is not foundin the current factory, the parent factory will be asked, up until the root factory. From the point of view of a caller, all factories in such a hierarchy will appear to be merged into one. Bean definitions in ancestor contexts are visible to descendant contexts, but not the reverse.All exceptions thrown by the BeanFactory interface and sub-interfaces extend org.springframework. beans.BeansException, and are unchecked. This reflects the fact that low-level configuration prob-lems are not usually recoverable: Hence, application developers can choose to write code to recover from such failures if they wish to, but should not be forced to write code in the majority of cases where config-uration failure is fatal.Most implementations of the BeanFactory interface do not merely provide a registry of objects by name; they provide rich support for configuring those objects using IoC. For example, they manage dependen-cies between managed objects, as well as simple properties. In the next section, we’ll look at how such configuration can be expressed in a simple and intuitive XML structure.The sub-interface org.springframework.beans.factory.ListableBeanFactory supports listing beans in a factory. It provides methods to retrieve the number of beans defined, the names of all beans, and the names of beans that are instances of a given type:public interface ListableBeanFactory extends BeanFactory {int getBeanDefinitionCount();String[] getBeanDefinitionNames();String[] getBeanDefinitionNames(Class type);boolean containsBeanDefinition(String name);Map getBeansOfType(Class type, boolean includePrototypes,boolean includeFactoryBeans) throws BeansException}The ability to obtain such information about the objects managed by a ListableBeanFactory can be used to implement objects that work with a set of other objects known only at runtime.In contrast to the BeanFactory interface, the methods in ListableBeanFactory apply to the current factory instance and do not take account of a hierarchy that the factory may be part of. The org.spring framework.beans.factory.BeanFactoryUtils class provides analogous methods that traverse an entire factory hierarchy.There are various ways to leverage a Spring bean factory, ranging from simple bean configuration to J2EE resource integration and AOP proxy generation. The bean factory is the central, consistent way of setting up any kind of application objects in Spring, whether DAOs, business objects, or web controllers. Note that application objects seldom need to work with the BeanFactory interface directly, but are usu-ally configured and wired by a factory without the need for any Spring-specific code.For standalone usage, the Spring distribution provides a tiny spring-core.jar file that can be embed-ded in any kind of application. Its only third-party dependency beyond J2SE 1.3 (plus JAXP for XML parsing) is the Jakarta Commons Logging API.The bean factory is the core of Spring and the foundation for many other services that the framework offers. Nevertheless, the bean factory can easily be used stan-dalone if no other Spring services are required.Derivative:networkSpring 框架简介Spring框架:这是一个流行的开源应用框架,它可以解决很多问题。

关于JSP的介绍-本科生毕业设计(论文)外文翻译

关于JSP的介绍-本科生毕业设计(论文)外文翻译

xx 理工大学xx 学院毕业设计(论文)外文资料翻译系:计算机系专业:计算机科学与技术姓名:xxx学号:080601165外文出处:Anon .The Introduction Of JSP [EB/OL].(用外文写)(2009-01-13)[2011-12-20].http://nibiye.com/fy/wwfy/jsjw/2009/0113/1033.html.附件:1.外文资料翻译译文;2.外文原文。

注:请将该封面与附件装订成册。

附件1:外文资料翻译译文关于JSP的介绍Java2企业版(J2EE)已经把建立一个网上的乱中有律任务的存在现象进行了有效的改造,就是开发人员能使用Java有效创造多层次的服务器端应用程序。

今天,Java企业应用程序编程接口已经扩大,包括许多方面:远程方法调用与公共对象请求代理体系结构用来远程对象的处理,JDBC(Java数据库的连接)的数据库交互,JNDI(Java命名和目录接口)来访问命名和目录服务,为企业创造了可重复使用的JavaBeans业务组件、JMS(Java信息服务)消息中介软件,JAXP为XML(可扩展标示语言)处理和JTA(Java事务应用程序界面)为执行一个原子事务。

此外,J2EE也支持小型服务程序,极受欢迎的Java语言代替了公共网关接口脚本。

这些技术的结合,可以让程序员创造分布式业务解决方案中的各种任务。

早在在1999年末,Sun Microsystems(美国一家计算机公司)添加了一个新的精选的元素企业Java工具:Java动态服务器页面(JSP)。

Java动态服务器页面都是建立在Java的顶部小型服务器用来增进效率使程序员,甚至是非专业的程序员,都可以创建网页的内容。

那么什么是Java服务器页呢?我们来简洁明点,Java的动态服务器页面是一个运用科学技术发展的网页,其中是包括动态内容的。

不像一个HTML页面,只包含静态内容,总是保持不变的,一个JSP页面中可以改变它的内容基于任何数量的变项,包括用户的身份,用户的浏览器类型,用户信息的提供,或者由用户选择信息等等。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Struts——一种开源MVC的实现这篇文章介绍Struts,一个使用servlet和JavaServer Pages技术的一种Model-View-Controller的实现。

Struts可以帮助你控制Web项目中的变化并提高专业化。

即使你可能永远不会用Struts实现一个系统,你可以获得一些想法用于你未来的servlet和JSP网页的实现中。

简介在小学校园里的小孩子们都可以在因特网上发布HTML网页。

然而,有一个重大的不同在一个小学生和一个专业人士开发的网站之间。

网页设计师(或者HTML开发人员)必须理解颜色、用户、生产流程、网页布局、浏览器兼容性、图像创建、JavaScript等等。

设计漂亮的网站需要做大量的工作,大多数Java开发人员更注重创建优美的对象接口,而不是用户界面。

JavaServer Pages(JSP)技术为网页设计人员和Java开发人员提供了一种联系钮带。

如果你开发过大型Web应用程序,你就理解“变化”这个词语。

“模型-视图-控制器”(MVC)就是用来帮助你控制变化的一种设计模式。

MVC减弱了业务逻辑接口和数据接口之间的耦合。

Struts是一种MVC实现,它将Servlet2.2和JSP 1.1标记(属于J2EE规范)用作实现的一部分。

你可能永远不会用Struts实现一个系统,但了解一下Struts或许使你能将其中的一些思想用于你以后的Servlet和JSP实现中。

模型-视图-控制器(MVC)JSP标签只解决了我们问题中的一部分。

我们依然有验证、流控制、以及更新应用程序结构的问题。

这就是MVC从哪儿来以及来干嘛的。

MVC通过把问题分成三类来帮助解决一些与单模块相关的问题:∙Model(模型)模块包括应用程序功能的核心。

模型封装着应用程序的各个结构。

有时它所包含的唯一功能就是结构。

它对于视图或者控制器一无所知。

∙View(视图)视图提供了模型的演示。

它是应用程序的外表。

视图可以进入模型获得者,但是它对于设置者一无所知。

除此之外,它对于控制器也是一无所知。

视图仅仅当模型发生改变的时候才被通知。

∙Controller(控制器)控制器对于用户的输入做出反应。

它创造和设置模型。

MVC模型2Web给软件开发人员带来了一些独特的挑战,最显著的就是客户端和服务器端的无结构连接。

这种无结构连接行为使得模型很难知道视图的改变。

在Web上,浏览器必须重复询问服务器端以此来发现应用程序结构的改变。

另外一个显而易见的改变就是相对于模型或者控制器,视图采用了不同的技术。

当然,我们可以使用Java(或者PERL、C/C++或之前的其他代码)代码来生成HTML。

这种方法存在一些弊端:∙Java程序员应该开发服务,而不是HTML。

∙布局的改变将需要改变代码。

∙服务的客户将有能力去创造一些页面去满足他们的一些特殊需求。

∙页面设计人员将不能直接介入到页面的开发中。

∙嵌入在代码中的HTML将会变得丑陋。

对于Web,MVC的经典形式将需要改变。

图4展示了MVC的Web适应,也就是通常所说的MVC模型2或者MVC2。

.图 4.MVC模型2Struts,MVC2的一种实现Struts是一组相互协作的类、servlet和JSP标记,它们组成一个可重用的MVC2设计。

这个定义表示Struts是一个框架,而不是一个库,但Struts也包含了丰富的标记库和独立于该框架工作的实用程序类。

图5显示了Struts的一个概览。

图 5.Struts概览Struts概览∙客户端浏览器一个来自客户端浏览器的HTTP创建一个事件。

Web容器将会用一个HTTP 响应来作出响应。

∙控制器控制器接收来自浏览器的请求,并决定发送请求到何处。

就Struts而言,控制器就是一个以servlet执行的一个命令设计模式。

struts-config.xml文件配置控制器。

∙业务逻辑业务逻辑更新模型的状态,并帮助控制应用程序的流。

就Struts而言,这就是通过作为实际业务逻辑“瘦”包装的Action类完成的。

∙模型状态模型代表了应用程序的状态。

业务对象更新应用程序的状态。

ActionFormbean在会话级或请求级表示模型的状态,而不是在持久级。

JSP文件使用JSP标记读取来自ActionForm bean的信息。

∙视图视图就是一个JSP文件。

其中没有流程逻辑,没有业务逻辑,也没有模型信息--只有标记。

标记是使Struts有别于其他框架(如Velocity)的因素之一。

Struts详细资料在图6中展示了一个无其他附属设备的阿帕奇struts的action包的UML图表。

图6显示了ActionServlet(Controller)、ActionForm(Form State)和Action(Model Wrapper)之间的最小关系。

图 6.命令(ActionServlet)与模型(Action&ActionForm)之间的关系的UML 图ActionServlet类你还记得使用函数映射的日子吗?你会映射一些输入时间到一个函数的一个指针。

如果你很老练,你可以把这些配置信息放进一个文件里并且在运行时加载该文件。

函数指针装扮了在C语言结构化程序设计中的旧时光。

现在日子好过多了,自从我们有了Java技术、XML、J2EE等等之后。

Struts控制器是一个映射事件(事件通常是一个HTTP post)到类的一个servlet。

猜猜怎么着--控制器用一个配置文件以致于你不必非硬编码这些值。

生活变了,但方法依然如此。

ActionServlet是MVC实现的命令部分并且它是框架的核心。

ActionServlet (Command)创建并使用Action、ActionForm和ActionForward。

正如前面所提及的,struts-config.xml文件配置Command。

在Web工程创建期间,Action和ActionForm被扩展用来解决特殊的问题空间。

文件struts-config.xml指导ActionServlet如何扩展这些类。

这种方法有几个优点:∙网页设计人员不必费力地通过Java代码来理解应用程序的流程。

∙当流程发生改变时Java开发人员不需要重新编译代码。

∙通过扩展ActionServlet命令函数可以被添加进来。

ActionForm类ActionForm维持着Web应用程序的会话状态。

ActionForm是一个必须为每个输入表单模型创建该类的子类的抽象类。

当我说输入表单模型时,我就是说ActionForm代表了一个由HTML表单设置或更新的一般意义上的数据。

例如,你可能有一个由HTML表单设置的UserActionForm。

Struts框架将会:∙检查UserActionForm是否存在;如果不存在,它将会创建该类的一个实例。

∙Struts将使用HttpServletRequest中相应的域设置UserActionForm的状态。

没有太多糟糕的请求.getParameter()调用。

例如,Struts框架将从请求流中提取fname并调用UserActionForm.setFname()。

∙Struts框架在将在传递它到业务包装UserAction之前将更新UserActionForm的状态。

∙在传递它到Action类之前,Struts将还会对UserActionForm调用validation()方法进行表单验证。

备注:这样做通常并不明智。

别的网页或业务对象可能有方法使用UserActionForm,然而验证可能不同。

在UserAction类中进行状态验证可能更好。

∙UserActionForm能够维持一个会话级别。

备注:∙struts-config.xml文件控制着HTML表单请求与ActionForm之间的映射。

∙多重请求会被映射到UserActionForm。

∙UserActionForm可被映射到诸如向导之类的多重页面的东西上。

Action类Action类是一个围绕业务逻辑的一个包装器。

Action类的目的就是将HttpServletRequest翻译给业务逻辑。

要使用Action,需重写process()原理。

ActionServlet(命令)通过使用perform()原理将参数化的类传递给ActionForm。

此外,没有太多讨厌的request.getParameter()调用。

通过事件到达这里的时间,输入表单数据(或HTML表单数据)已经被从请求流中翻译出来并进入ActionForm类中。

注:扩展Action类时请注意简洁。

Action类应该控制应用程序的流程,而不应该控制应用程序的逻辑。

通过将业务逻辑放在单独的包或EJB中,我们就可以提供更大的灵活性和可重用性。

考虑Action类的另一种方式是Adapter设计模式。

Action的用途是“将类的接口转换为客户机所需的另一个接口。

Adapter使类能够协同工作,如果没有Adapter,则这些类会因为不兼容的接口而无法协同工作。

”(摘自Gof所著的Design Patterns-Elements of Reusable OO Software)。

本例中的客户机是ActionServlet,它对我们的具体业务类接口一无所知。

因此,Struts提供了它能够理解的一个业务接口,即Action。

通过扩展Action,我们使得我们的业务接口与Struts业务接口保持兼容。

(一个有趣的发现是,Action是类而不是接口)。

Action 开始为一个接口,后来却变成了一个类。

真是金无足赤。

)Error类UML图(图6)还包括ActionError和ActionErrors。

ActionError封装了单个错误消息。

ActionErrors是ActionError类的容器,View可以使用标记访问这些类。

ActionError是Struts保持错误列表的方式。

图mand(ActionServlet)与Model(Action)之间的关系的UML图ActionMapping类输入事件通常是在HTTP请求表单中发生的,servlet容器将HTTP请求转换为HttpServletRequest。

控制器查看输入事件并将请求分派给某个Action类。

struts-config.xml确定Controller调用哪个Action类。

struts-config.xml配置信息被转换为一组ActionMapping,而后者又被放入ActionMappings容器中。

(你可能尚未注意到这一点,以s结尾的类就是容器)ActionMapping包含有关特定事件如何映射到特定Action的信息。

ActionServlet(Command)通过perform()方法将ActionMapping传递给Action 类。

相关文档
最新文档