外文文献及翻译

合集下载

毕业论文(设计)外文文献翻译及原文

毕业论文(设计)外文文献翻译及原文

金融体制、融资约束与投资——来自OECD的实证分析R.SemenovDepartment of Economics,University of Nijmegen,Nijmegen(荷兰内梅亨大学,经济学院)这篇论文考查了OECD的11个国家中现金流量对企业投资的影响.我们发现不同国家之间投资对企业内部可获取资金的敏感性具有显著差异,并且银企之间具有明显的紧密关系的国家的敏感性比银企之间具有公平关系的国家的低.同时,我们发现融资约束与整体金融发展指标不存在关系.我们的结论与资本市场信息和激励问题对企业投资具有重要作用这种观点一致,并且紧密的银企关系会减少这些问题从而增加企业获取外部融资的渠道。

一、引言各个国家的企业在显著不同的金融体制下运行。

金融发展水平的差别(例如,相对GDP的信用额度和相对GDP的相应股票市场的资本化程度),在所有者和管理者关系、企业和债权人的模式中,企业控制的市场活动水平可以很好地被记录.在完美资本市场,对于具有正的净现值投资机会的企业将一直获得资金。

然而,经济理论表明市场摩擦,诸如信息不对称和激励问题会使获得外部资本更加昂贵,并且具有盈利投资机会的企业不一定能够获取所需资本.这表明融资要素,例如内部产生资金数量、新债务和权益的可得性,共同决定了企业的投资决策.现今已经有大量考查外部资金可得性对投资决策的影响的实证资料(可参考,例如Fazzari(1998)、 Hoshi(1991)、 Chapman(1996)、Samuel(1998)).大多数研究结果表明金融变量例如现金流量有助于解释企业的投资水平。

这项研究结果解释表明企业投资受限于外部资金的可得性。

很多模型强调运行正常的金融中介和金融市场有助于改善信息不对称和交易成本,减缓不对称问题,从而促使储蓄资金投着长期和高回报的项目,并且提高资源的有效配置(参看Levine(1997)的评论文章)。

因而我们预期用于更加发达的金融体制的国家的企业将更容易获得外部融资.几位学者已经指出建立企业和金融中介机构可进一步缓解金融市场摩擦。

外文文献及翻译

外文文献及翻译

外文文献原稿和译文原稿DATABASEA database may be defined as a collection interrelated data store together with as little redundancy as possible to serve one or more applications in an optimal fashion .the data are stored so that they are independent of programs which use the data .A common and controlled approach is used in adding new data and in modifying and retrieving existing data within the data base .One system is said to contain a collection of database if they are entirely separate in structure .A database may be designed for batch processing , real-time processing ,or in-line processing .A data base system involves application program, DBMS, and database.THE INTRODUCTION TO DATABASE MANAGEMENT SYSTEMSThe term database is often to describe a collection of related files that is organized into an integrated structure that provides different people varied access to the same data. In many cases this resource is located in different files in different departments throughout the organization, often known only to the individuals who work with their specific portion of the total information. In these cases, the potential value of the information goes unrealized because a person in other departments who may need it does not know it or it cannot be accessed efficiently. In an attempt to organize their information resources and provide for timely and efficient access, many companies have implemented databases.A database is a collection of related data. By data, we mean known facts that can be recorded and that have implicit meaning. For example, the names, telephone numbers, and addresses of all the people you know. You may have recorded this data in an indexed address book, or you may have stored it on a diskette using a personalcomputer and software such as DBASE Ⅲor Lotus 1-2-3. This is a collection of related data with an implicit meaning and hence is a database.The above definition of database is quite general. For example, we may consider the collection of words that made up this page of text to be usually more restricted. A database has the following implicit properties:● A database is a logically coherent collection of data with some inherent meaning. A random assortment of data cannot be referred to as a database.● A database is designed, built, and populated with data for a specific purpose. It has an intended group of user and some preconceived applications in which these users are interested.● A database represents some aspect of the real world, sometimes called the miniworld. Changes to the miniworld are reflected in the database.In other words, a database has some source from which data are derived, some degree of interaction with events in the real world, and an audience that is actively interested in the contents of the database.A database management system (DBMS) is composed of three major parts: (1) a storage subsystem that stores and retrieves data in files; (2)a modeling and manipulation subsystem that provides the means with which to organize the data and to add, delete, maintain, and update the data; and (3) an interface between the DBMS and its users. Several major trends are emerging that enhance the value and usefulness of database management systems.●Managers who require more up-to-date information to make effective decisions.●Customers who demand increasingly sophisticated information services and more current information about the status of their orders, invoices, and accounts.●Users who find that they can develop custom applications with database systems in a fraction of the time it takes to use traditional programming languages.●Organizations that discover information has a strategic value; they utilize their database systems to gain an edge over their competitors.A DBMS can organize, process, and present selected data elements from the database. This capability enables decision makers to search, probe, and query database contents in order to extract answers to nonrecurring and unplanned questions that aren’t available in regular reports. These questions might initially be vague and/or p oorly defined, but people can “browse” through the database until they have the needed information. In short, the DBMS will “mange” the stored data items and assemble the needed items from the common database in response to the queries of those who aren’t programmers. In a file-oriented system, user needing special information may communicate their needs to a programmer, who, when time permits, will write one or more programs to extract the data and prepare the information. The availability of a DBMS, however, offers users a much faster alternative communications path.DATABASE QUERYIf the DBMS provides a way to interactively enter and update the database ,as well as interrogate it ,this capability allows for managing personal database. However, it does not automatically leave an audit trail of actions and does not provide the kinds of controls necessary in a multi-user organization .There controls are only available when a set of application programs is customized for each data entry and updating function.Software for personal computers that perform some of the DBMS functions has been very popular .Individuals for personal information storage and processing intended personal computers for us .Small enterprises, professionals like doctors, architects, engineers, lawyers and so on have also used these machines extensively. By the nature of intended usage ,database system on there machines are except from several of the requirements of full-fledged database systems. Since data sharing is not intended, concurrent operations even less so ,the software can be less complex .Security and integrity maintenance are de-emphasized or absent .as data volumes will be small, performance efficiency is also less important .In fact, the only aspect of a database system that is important is data independence. Data independence ,as stated earlier ,means that application programs and user queries need not recognize physical organization of data on secondary storage. The importance of this aspect , particularly for the personal computer user ,is that this greatly simplifies database usage . The user can store ,access and manipulate data at ahigh level (close to the application)and be totally shielded from the low level (close to the machine )details of data organization.DBMS STRUCTURING TECHNIQUESSpatial data management has been an active area of research in the database field for two decades ,with much of the research being focused on developing data structures for storing and indexing spatial data .however, no commercial database system provides facilities for directly de fining and storing spatial data ,and formulating queries based on research conditions on spatial data.There are two components to data management: history data management and version management .Both have been the subjects of research for over a decade. The troublesome aspect of temporal data management is that the boundary between applications and database systems has not been clearly drawn. Specifically, it is not clear how much of the typical semantics and facilities of temporal data management can and should be directly incorporated in a database system, and how much should be left to applications and users. In this section, we will provide a list of short-term research issues that should be examined to shed light on this fundamental question.The focus of research into history data management has been on defining the semantics of time and time interval, and issues related to understanding the semantics of queries and updates against history data stored in an attribute of a record. Typically, in the context of relational databases ,a temporal attribute is defined to hold a sequence of history data for the attribute. A history data consists of a data item and a time interval for which the data item is valid. A query may then be issued to retrieve history data for a specified time interval for the temporal attribute. The mechanism for supporting temporal attributes is to that for supporting set-valued attributes in a database system, such as UniSQL.In the absence of a support for temporal attributes, application developers who need to model and history data have simply simulated temporal attributes by creating attribute for the time interval ,along with the “temporal” attribute. This of course may result in duplication of records in a table, and more complicated search predicates in queries. The one necessary topic of research in history data management is to quantitatively establish the performance (and even productivity) differences betweenusing a database system that directly supports attributes and using a conventional database system that does not support either the set-valued attributes or temporal attributes.Data security, integrity, and independenceData security prevents unauthorized users from viewing or updating the database. Using passwords, users are allowed access to the entire database of the database, called subschemas. For example, an employee database can contain all the data about an individual employee, but one group of users may be authorized to view only payroll data, while others are allowed access to only work history and medical data.Data integrity refers to the accuracy, correctness, or validity of the data in the database. In a database system, data integrity means safeguarding the data against invalid alteration or destruction. In large on-line database system, data integrity becomes a more severe problem and two additional complications arise. The first has to do with many users accessing the database concurrently. For example, if thousands of travel agents book the same seat on the same flight, the first agent’s booking will be lost. In such cases the technique of locking the record or field provides the means for preventing one user from accessing a record while another user is updating the same record.The second complication relates to hardware, software or human error during the course of processing and involves database transaction which is a group of database modifications treated as a single unit. For example, an agent booking an airline reservation involves several database updates (i.e., adding the passenger’s name and address and updating the seats-available field), which comprise a single transaction. The database transaction is not considered to be completed until all updates have been completed; otherwise, none of the updates will be allowed to take place.An important point about database systems is that the database should exist independently of any of the specific applications. Traditional data processing applications are data dependent.When a DMBS is used, the detailed knowledge of the physical organization of the data does not have to be built into every application program. The application program asks the DBMS for data by field name, for example, a coded representationof “give me customer name and balance due” would be sent to the DBMS. Without a DBMS the programmer must reserve space for the full structure of the record in the program. Any change in data structure requires changes in all the applications programs.Data Base Management System (DBMS)The system software package that handles the difficult tasks associated with creating ,accessing and maintaining data base records is called a data base management system (DBMS). A DBMS will usually be handing multiple data calls concurrently.It must organize its system buffers so that different data operations can be in process together .It provides a data definition language to specify the conceptual schema and most likely ,some of the details regarding the implementation of the conceptual schema by the physical schema.The data definition language is a high-level language, enabling one to describe the conceptual schema in terms of a “data model “.At the present time ,there are four underling structures for database management systems. They are :List structures.Relational structures.Hierarchical (tree) structures.Network structures.Management Information System(MIS)An MIS can be defined as a network of computer-based data processing procedures developed in an organization and integrated as necessary with manual and other procedures for the purpose of providing timely and effective information to support decision making and other necessary management functions.One of the most difficult tasks of the MIS designer is to develop the information flow needed to support decision making .Generally speaking ,much of the information needed by managers who occupy different levels and who have different levels and have different responsibilities is obtained from a collection of exiting information system (or subsystems)Structure Query Language (SQL)SQL is a data base processing language endorsed by the American NationalStandards Institute. It is rapidly becoming the standard query language for accessing data on relational databases .With its simple ,powerful syntax ,SQL represents a great progress in database access for all levels of management and computing professionals.SQL falls into two forms : interactive SQL and embedded SQL. Embedded SQL usage is near to traditional programming in third generation languages .It is the interactive use of SQL that makes it most applicable for the rapid answering of ad hoc queries .With an interactive SQL query you just type in a few lines of SQL and you get the database response immediately on the screen.译文数据库数据库可以被定义为一个相互联系的数据库存储的集合。

浙江大学本科毕业论文外文文献翻译

浙江大学本科毕业论文外文文献翻译

核准通过,归档资料。

未经允许,请勿外传!浙江大学本科毕业论文外文文献翻译The influence of political connections on the firm value of small and medium-sized enterprises in China政治关联在中国对中小型企业价值的影响1摘要中小型企业的价值受很多因素的影响,比如股东、现金流以及政治关联等.这篇文章调查的正是在中国政治关联对中小型企业价值的影响。

通过实验数据来分析政治关联对企业价值效益的影响.结果表明政府关联是关键的因素并且在中国对中小型企业的价值具有负面影响。

2重要内容翻译2。

1引言在商业界,有越来越多关于政治关联的影响的经济研究。

它们发现政治关联能够帮助企业确保有利的规章条件以及成功获得资源,比如能够最终提高企业价值或是提升绩效的银行贷款,这种政治关联的影响在不同的经济条件下呈现不同的效果。

在高腐败和法律制度薄弱的国家,政治关联对企业价值具有决定性因素1的作用.中国由高度集权的计划经济向市场经济转变,政府对市场具有较强的控制作用,而且有大量的上市企业具有政治关联。

中小型企业发展的很迅速,他们已经在全球经济环境中变得越来越重要。

从90年代起, 政治因素对中国的任何规模的企业来说都变得越来越重要,尤其是中小型企业的价值。

和其他的部门相比较,中小型企业只有较小的现金流,不稳定的现金流且高负债率.一方面,中小型企业改变更加灵活;另一方面,中小型企业在由于企业规模以及对银行来说没有可以抵押的资产,在筹资方面较为困难。

企业如何应对微观经济环境和政策去保证正常的企业活动,并且政治关联如何影响企业价值?这篇论文调查政治关联和企业价值之间的联系,并且试图去研究企业是否可以从政治关联中获利提升企业价值。

2.2定义这些中小型企业之所以叫中小型企业,是和管理规模有关。

对这些小企业来说,雇员很少,营业额较低,资金一般由较少的人提供,因此,通常由这些业主直接管理企业。

外文文献翻译(图片版)

外文文献翻译(图片版)

本科毕业论文外文参考文献译文及原文学院经济与贸易学院专业经济学(贸易方向)年级班别2007级 1 班学号3207004154学生姓名欧阳倩指导教师童雪晖2010 年 6 月 3 日目录1 外文文献译文(一)中国银行业的改革和盈利能力(第1、2、4部分) (1)2 外文文献原文(一)CHINA’S BANKING REFORM AND PROFITABILITY(Part 1、2、4) (9)1概述世界银行(1997年)曾声称,中国的金融业是其经济的软肋。

当一国的经济增长的可持续性岌岌可危的时候,金融业的改革一直被认为是提高资金使用效率和消费型经济增长重新走向平衡的必要(Lardy,1998年,Prasad,2007年)。

事实上,不久前,中国的国有银行被视为“技术上破产”,它们的生存需要依靠充裕的国家流动资金。

但是,在银行改革开展以来,最近,强劲的盈利能力已恢复到国有商业银行的水平。

但自从中国的国有银行在不久之前已经走上了改革的道路,它可能过早宣布银行业的改革尚未取得完全的胜利。

此外,其坚实的财务表现虽然强劲,但不可持续增长。

随着经济增长在2008年全球经济衰退得带动下已经开始软化,银行预计将在一个比以前更加困难的经济形势下探索。

本文的目的不是要评价银行业改革对银行业绩的影响,这在一个完整的信贷周期后更好解决。

相反,我们的目标是通过审查改革的进展和银行改革战略,并分析其近期改革后的强劲的财务表现,但是这不能完全从迄今所进行的改革努力分离。

本文有三个部分。

在第二节中,我们回顾了中国的大型国有银行改革的战略,以及其执行情况,这是中国银行业改革的主要目标。

第三节中分析了2007年的财务表现集中在那些在市场上拥有浮动股份的四大国有商业银行:中国工商银行(工商银行),中国建设银行(建行),对中国银行(中银)和交通银行(交通银行)。

引人注目的是中国农业银行,它仍然处于重组上市过程中得适当时候的后期。

第四节总结一个对银行绩效评估。

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

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

毕业设计(论文)外文文献翻译院系:财务与会计学院年级专业:201*级财务管理姓名:学号:132148***附件: 财务风险管理【Abstract】Although financial risk has increased significantly in recent years risk and risk management are not contemporary issues。

The result of increasingly global markets is that risk may originate with events thousands of miles away that have nothing to do with the domestic market。

Information is available instantaneously which means that change and subsequent market reactions occur very quickly。

The economic climate and markets can be affected very quickly by changes in exchange rates interest rates and commodity prices。

Counterparties can rapidly become problematic。

As a result it is important to ensure financial risks are identified and managed appropriately. Preparation is a key component of risk management。

【Key Words】Financial risk,Risk management,YieldsI. Financial risks arising1.1What Is Risk1.1.1The concept of riskRisk provides the basis for opportunity. The terms risk and exposure have subtle differences in their meaning. Risk refers to the probability of loss while exposure is the possibility of loss although they are often used interchangeably。

外文文献及翻译

外文文献及翻译

外文文献及翻译1. 文献:"The Effects of Exercise on Mental Health"翻译:运动对心理健康的影响Abstract: This article explores the effects of exercise on mental health. The author discusses various studies that have been conducted on this topic, and presents evidence to support the claim that exercise can have positive impacts on mental well-being. The article also examines the mechanisms through which exercise affects mental health, such as the release of endorphins and the reduction of stress hormones. Overall, the author concludes that exercise is an effective strategy for improving mental health and recommends incorporating physical activity into daily routines.摘要:本文探讨了运动对心理健康的影响。

作者讨论了在这个主题上进行的各种研究,并提出证据支持运动对心理健康有积极影响的观点。

该文章还探讨了运动如何影响心理健康的机制,如内啡肽的释放和压力激素的减少。

总的来说,作者得出结论,运动是改善心理健康的有效策略,并建议将体育活动纳入日常生活。

2. 文献: "The Benefits of Bilingualism"翻译:双语能力的好处Abstract: This paper examines the benefits of bilingualism. The author presents research findings that demonstrate the cognitiveadvantages of being bilingual, such as enhanced problem-solving skills and improved attention control. The article also explores the social and cultural benefits of bilingualism, such as increased cultural awareness and the ability to communicate with people from different backgrounds. Additionally, the author discusses the positive effects of bilingualism on mental health, highlighting its role in delaying the onset of cognitive decline and in providing a buffer against age-related memory loss. Overall, the author concludes that bilingualism offers a range of advantages and recommends promoting bilingual education and language learning. 摘要:本文研究了双语能力的好处。

外文文献及翻译

外文文献及翻译

Yunnan Ethnic pattern in Packaging DesignAbstract: Art is a folk Mother of the arts,is the source of the new art, From which to draw a strong tradition of high—grade Nutrition。

The persons belonging to national folk arts Ethnic patterns,are folk arts Intraoperative a gem, its development Research,and with the means of modern art,art wind Grid,professional skills combine to form a unique Style and features a modern design There are important applications,this paper focuses on Minority Folk pattern in modern packaging design Meter applications are discussed.Keywords: Yunnan Ethnic. Pattern。

Packaging Design.IntroductionYunnan is a multi-ethnic province, Here multiply survive the Han, Yi, Bai More than twenty families, Zhuang, Miao, Dai, etc。

Nation. Long history of various ethnic groups in Yunnan Province, the source is far Long, creating a rich and colorful Folk art。

电气工程的外文文献(及翻译)

电气工程的外文文献(及翻译)

电气工程的外文文献(及翻译)文献一:Electric power consumption prediction model based on grey theory optimized by genetic algorithms本文介绍了一种基于混合灰色理论与遗传算法优化的电力消耗预测模型。

该模型使用时间序列数据来建立模型,并使用灰色理论来解决数据的不确定性问题。

通过遗传算法的优化,模型能够更好地预测电力消耗,并取得了优异的预测结果。

此模型可以在大规模电力网络中使用,并具有较高的可行性和可靠性。

文献二:Intelligent control for energy-efficient operation of electric motors本文研究了一种智能控制方法,用于电动机的节能运行。

该方法提供了一种更高效的控制策略,使电动机能够在不同负载条件下以较低的功率运行。

该智能控制使用模糊逻辑方法来确定最佳的控制参数,并使用遗传算法来优化参数。

实验结果表明,该智能控制方法可以显著降低电动机的能耗,节省电能。

文献三:Fault diagnosis system for power transformers based on dissolved gas analysis本文介绍了一种基于溶解气体分析的电力变压器故障诊断系统。

通过对变压器油中的气体样品进行分析,可以检测和诊断变压器内部存在的故障类型。

该系统使用人工神经网络模型来对气体分析数据进行处理和分类。

实验结果表明,该系统可以准确地检测和诊断变压器的故障,并有助于实现有效的维护和管理。

文献四:Power quality improvement using series active filter based on iterative learning control technique本文研究了一种基于迭代研究控制技术的串联有源滤波器用于电能质量改善的方法。

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

文献翻译原文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 tothe 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 / doPost / 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.After another visit this page to the customer, as long as the paper there have been nochanges, 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 the servlet. 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 otherHTTP 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 acontainer that doesn't yet support this version of the specification, I'm afraid you're out 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 new session 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 the pages 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 data schema or database engine in more than one part of the application: beans in the role of Model can be used to accomplish this.●The database access beans must be made available to all other parts of the application when it starts: an application lifecycle event listener is the perfect component type for this task.●Only authenticated users must be allowed to use the application: a filter can performaccess 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 the View.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 processing requests in a flexible manner.● A mechanism for changing the page flow of the application without modifying code.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass throughit. 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开发服务器端应用的主要技术,是开发商务应用表示端的标准。

相关文档
最新文档