第一篇:畢業設計網上選課系統ASP外文翻譯
論文題目姓名學號班級年級專業學院指導教師完成時間
外文翻譯
(一)網上選課系統
軟件工程
軟件學院
2014年 5 月13日
: : : : : : : : :
東華理工大學畢業設計(外文翻譯)
英文原文
英文原文
The Active Server Pages(ASP)is a server to carry the script plait writes the environment, using it can create to set up with circulate the development, alternant Web server application procedure.Using the ASP cans combine the page of HTML, script order to create to set up the alternant the page of Web with the module of ActiveX with the mighty and applied procedure in function that according to Web.The applied procedure in ASP develops very easily with modify.1.The working principle of ASP
When the Web site into the ASP feature, will take place the following things:(1)the user browser address bar to enter a URL, the default page of the expansion are.Asp.(2)the browser request to the server.(3)the server engine running ASP procedures.(4)ASP document in accordance with the order from top to bottom starting with the implementation of the script orders, the implementation of HTML page content.(5)pages of information sent to the browser.2.ASP operating environment Asp need to run in under the PWS or IIS.PWS or IIS services in windows98 or windows2000 on the fringe of the CD-ROM, can use the “Add / Remove Programs” in the “Add / Remove windows components” to install.Asp and the general need to access databases or a combination of SQL Server database, made a powerful process.ASP can run the web server software
Windows2000 default installation is IIS5.0(internet information server), and the default installation of windows xp is IIS5.1, windows 2003 default installation of IIS6.0.PWS(personal web server)running windows98 environment in a simple personal Web server.3.ASP and the meaning of ASP(Application Service Provider, application software rental service providers)refers “through the Internet to provide application software rental services industry”, refers to the application software industry as the mainstay, and through one-to-many network Transmission services, such service-based business transactions to be leased by the way, in a more cost-effective manner has the right to use the software, and also because the industry centralized management and greatly reduce the cost of maintaining enterprises.1 東華理工大學畢業設計(外文翻譯)
英文原文
Basically, ASP is a “software services, Internet services,” and “outsourcing of information services and network integration” and “access of products, access products,” such as the three major characteristics, can even be seen as ISP(Internet Service Provider)and ITS(Information Technology Service)combination.ASP is the English Application Service Provider, the standard Chinese translation is “application service provider”, is defined as commercial or individual customer management applications to provide solutions for companies or enterprises.ASP Chaozuo recently by the media is very fiery, the IT industry is not facing a pile of technical terms it is very difficult to clarify terminology ASP content, the paper tried to use simple language to the broad masses of readers opened the mysterious veil of ASP, IT Top of the ASP industry areas have some basic knowledge.4.Origin of ASP
The research to ASP mode and ASP enterprise's origin can proceed with two respects , one to in terms of business and technology , is it carry on research to come from ASP developing history that business commit;Another one is studies the origins of ASP enterprises and evolution course at present in terms of organization's development.Whether stand up synthetically above-mentioned developing stage, to put it briefly, present ASP history and development path of provider can simple to describe as: The first, developed from the past ISP, rounded the infrastructure and communication function, cooperate with software manufacturer, increase the business scope, develop into the present IDC(the data centre of Internet);
The second,the past ISV(independent software provider)and VAR(the trader that resells value-added service), at Internet age , changed the marketing way in the past , would rely mainly on sale of the software product to change direction to rely mainly on the fact that right to use is leased in the past, bale from physics carrier encapsulation way change direction and long-range operation way main fact now, through the cooperation with network operator , realize the transition to ASP;
The third,IT service departments and traditional advisory companies of traditional large-scale organization, at the foundation known deeply in Internet , depend on long-term experience, is it carry on systematic design and implementation of scheme for other customer to begin, through establish in with trader who operates network and alliance relation between the application software manufacturer, realize the ASP provider that appears in the capacity of system integration trader.5.The developing history and classification of ASP
Seen from the present, ASP is as emerging and proposing formally it is only a thing from the end of 1998 to the beginning of 1999 of a kind of mode.And until from the end of 1999 to the beginning of 2000 to a great extent, ASP field relevant東華理工大學畢業設計(外文翻譯)
英文原文
outstanding behaviors at the capital market of Company just cause people's extensive concern.In fact speaking from the intension and essence of ASP mode, it is not the brand-new things, but the mode that had once had, has been given the new vitality at Internet age.During this festival, we will review the course that ASP produce development and develop, in order to help the essence of better deep understanding ASP.At the end, we will concentrate on introducing the situation which enterprises divide from different standards in ASP field at present.The HTML plait writes the personnel if you are a simple method that a HTML plait writes the personnel, you will discover the script of ASP providing to create to have diplomatic relation with each other page.If you once want that collect the data from the form of HTML, or use the name personalization HTML document of the customer, or according to the different characteristic in different usage of the browser, you will discover ASP providing an outstanding solution.Before, to think that collect the data from the form of HTML, have to study a plait distance language to create to set up a CGI application procedure.Now, you only some simple instruction into arrive in your HTML document, can collect from the form the data combine proceeding analysis.You need not study the complete plait distance language again or edit and translate the procedure to create to have diplomatic relation alone with each other page.Along with control to use the ASP continuously with the phonetic technique in script, you can create to set up the more complicated script.For the ASP, you can then conveniently usage ActiveX module to carry out the complicated mission, link the database for example with saving with inspectional information.If you have controlled a script language, such as VBScript, JavaScript or PERL, and you have understood the method that use the ASP.As long as installed to match the standard cowgirl in the script of ActiveX script engine, can use in the page of ASP an any a script language.Does the ASP take the Microsoft? Visual Basic? Scripting Edition(VBScript)with Microsoft? Script? Of script engine, like this you can start the editor script immediately.PERL, REXX with Python ActiveX script engine can from the third square develops the personnel acquires.The Web develops the personnel if you have controlled a plait distance language, such as Visual Basic, you will discover the ASP creates a very vivid method that set up the Web application procedure quickly.Pass to face to increase in the HTML the script order any, you can create the HTML that set up the applied procedure connects.Pass to create to set up own the module of ActiveX, can will apply the business in the procedure logic seal to 東華理工大學畢業設計(外文翻譯)
英文原文
pack and can adjust from the script, other module or from the other procedure the mold piece that use.The usage ASP proceeds the calculating Web can convert into the visible benefits, it can make the supplier of Web provide the alternant business application but not only is to announce the contents.For example, the travel agency can compare the announcement aviation schedule makes out more;Using the script of ASP can let the customer inspect the current service, comparison expenses and prepare to book seats.Include too can lower in the Windows NT Option Microsoft in the pack Transaction Server(MTS)on the server complexity of constructing the procedure with expenses.The MTS can resolve to develop those confidentialities strong, can ratings of and the dependable Web applies the complexity problem of the procedure.6.Active Server Pages model The browser requests from the server of Web.Hour of asp document, the script of ASP starts circulating.Then the server of Web adjusts to use the ASP, the ASP reads completely the document of the claim, carry out all scripts order any, combining to deliver the page of Web to browser.Because script is on the server but is not at the customer to carry the movement, deliver the page of Web on the browser is on the Web server born.Combining to deliver the standard HTML to browser.Because only the result that there is script returns the browser, so the server carries the not easy replication in script.The customer cans not see to create to set up them at script order that the page that view.We introduce the Basic form of the database language known as SQL, a language that allows us to query and manipulate data on computerized relational database systems.SQL has been the lingua franca for RDBMS since the early 1980s, and it is of fundamental importance for many of the concepts presented in this text.The SQL language is currently in transition from the relational form(the ANSI SQL – 92 standard)to a newer object-relational form(ANSI SQL-99, which was released in 1999).SQL-99 should be thought of as extending SQL-92, not changing any of the earlier valid language.Usually, the basic SQL we define matches most closely the ANSI SQL standards basic subsets, called Entry SQL-92 and core SQL-99 that are commonly implemented;our touchstone in defining basic SQL is to provide a syntax that is fully available on most of the major RDBMS products.東華理工大學畢業設計(外文翻譯)
英文原文
We begin with an overview of SQL capabilities, and then we explain something about the multiple SQL standards and dialects and how we will deal with these in our presentation.We will learn how to pose comparable queries in SQL, using a form known as the Select statement.As we will see, the SQL select statement offers more flexibility in a number of ways than relational algebra for posing queries.However, there is no fundamental improvement in power, nothing that could not be achieved in relational algebra , given a few well-considered extensions.For this reason, experience with relational algebra gives us a good idea of what can be accomplished in SQL.At the same time, SQL and relational algebra have quite different conceptual models in a number of respects, and the insight drawn from familiarity with the relational algebra approach may enhance your understanding of SQL capabilities.The most important new feature you will encounter with SQL is the ability to pose queries interactively in a computerized environment.The SQL select statement is more complicated and difficult to master than the relatively simple relational algebra, but you should never feel list or uncertain as long as you have access to computer facilities where a few experiments can clear up uncertainties about SQL use.The interactive SQL environment discussed in the current chapter allows you to type a query on a monitor screen and get an immediate answer.Such interactive queries are sometimes called ad box queries.This term refers to the fact that an SQL select statement is meant to be composed all at once in a few type written lines and not be dependent on any prior interaction in a user session.The feature of not being dependent on prior interaction is also down as non-procedurality.SQL differs in this way even from relational algebra, where a prior alias statement might be needed in order to represent a product of a table with itself.The difference between SQL and procedural languages such as java or c is profound: you do not need to write a program to try out an SQL query, you just have to type the relatively short, self-contained text of the query and submit it.Of course, an SQL query can be rather complex.A limited part of this full form, know as a sub-query, is defined recursively, and the full select statement form has one added clause.You should not feel intimidated by the complexity of the select statement, however.The fact that a select statement is non-procedural means that it has a lot in common with a menu driven application, where a user is expected to fill in some set of choices from a menu and then press the enter key to execute the menu 東華理工大學畢業設計(外文翻譯)
英文原文
choices all at once.The various clauses of the select statement correspond to menu choices: you will occasionally need all these clauses, but on not expect to use all of them every time you pose a query.Observed reliability depends on the context in which the system s used.As discussed already, the system environment cannot be specified in advance nor can the system designers place restrictions on that environment for operational systems.Different systems in an environment may react to problems in unpredictable ways, thus affecting the reliability of all of these systems.There for, even when the system has been integrated, it may be difficult to make accurate measurements of its reliability.7.Visual Basic Database Access prospects With the recent Web application software and the rapid development of the existing data stored in diverse forms, Visual Basic Database Access Solutions faces such as rapid extraction enterprises located in the internal and external business information with the multiple challenges.To this end Microsoft, a new database access strategy “unified data access”(UniversalDataAccess)strategy.“Unified data access” to provide high-performance access, including relational and non-relational data in a variety of sources, provide independent in the development of language development tools and the simple programming interface, these technologies makes enterprise integration of multiple data sources, better choice of development tools, application software, operating platforms, and will establish a maintenance easy solution possible.東華理工大學畢業設計(外文翻譯)
漢語翻譯
漢語翻譯
Active Server Pages(ASP)是服務器端腳本編寫環境,使用它可以創建和運行動態、交互的 Web 服務器應用程序。使用 ASP 可以組合 HTML 頁、腳本命令和 ActiveX 組件以創建交互的 Web 頁和基于 Web 的功能強大的應用程序。ASP 應用程序很容易開發和修改。1.ASP的工作原理
當在Web站點中融入ASP功能后,將發生以下事情:
(1)用戶向瀏覽器地址欄輸入網址,默認頁面的擴展名是.asp;
(2)瀏覽器向服務器發出請求;
(3)服務器引擎開始運行ASP程序;
(4)ASP文件按照從上到下的順序開始處理,執行腳本命令,執行HTML頁面內容;
(5)頁面信息發送到瀏覽器;
2.ASP的運行環境
ASP需要運行在PWS或IIS下。PWS或IIS服務在windows98或windows2000的光盤上附帶著,可以通過“添加/刪除程序”中的“添加/刪除windows組件”來安裝。
一般asp需與access數據庫或SQL Server數據庫結合使用,編出功能強大的程序。能夠運行ASP的web服務器軟件:
Windows2000默認安裝的是IIS5.0(internet information server),而windows XP默認安裝的是IIS5.1,windows 2003默認安裝的IIS6.0。
PWS(personal web server)運行在windows98環境下的簡單個人網頁服務器。3.ASP的意義與特性
ASP(Application Service Provider,應用軟體租賃服務提供者)是指“透過網路以租賃方式提供應用軟體服務的業者”,即業者以應用軟體為主體,透過網路一對多地傳遞服務,這種以服務為主的交易模式促使企業可藉由租賃的方式,以更符合成本效益的方式擁有軟體的使用權,并且亦能因為業者集中式的管理而大幅降低企業維護的成本。
基本上,ASP即具有“軟體服務化,服務網路化”,“資訊委外服務與網路結合”與“產品通路化,通路產品化”等三大特性,甚至可以被視為是ISP(Internet Service Provider)與ITS(Information Technology Service)的結合。
ASP的英文是Application Service Provider,中文的標準翻譯就是“應用服務提供商”,是指為商業或者個人客戶提供管理應用解決方案的公司或者企業。最近ASP被媒體炒作的十分火熱,不是IT行業的人面對一堆技術名詞專業術語很 東華理工大學畢業設計(外文翻譯)
漢語翻譯
難弄清楚ASP的內容,本文試圖用淺顯的語言來為廣大的讀者揭開ASP神秘的面紗,對于IT行業的大熱門ASP領域有一些基本的認識。
4.ASP的起源
對于ASP模式和ASP企業起源的研究可以從兩個方面入手,一個是從業務和技術的角度,從ASP業務構成的發展歷史來進行研究;另一個是從組織機構發展的角度,來研究目前ASP企業的由來和演化過程。
將上述發展階段綜合起來,簡單的說,目前的ASP提供商的歷史和發展道路可以簡單的描述為:
第一類,從過去的ISP發展起來,圍繞基礎設施和通訊功能,與軟件廠商合作,增加業務范圍,發展到現在的IDC(互聯網數據中心);
第二類,過去的ISV(獨立軟件提供商)和VAR(增值服務轉售商),在互聯網時代,改變過去的營銷方式,將過去以軟件產品的出售為主轉向以使用權租賃為主,從物理載體的打包封裝方式轉向現在在線和遠程運行方式為主,通過與網絡運營商的合作,實現向ASP的轉型;
第三類,傳統的大型組織的IT服務部門和傳統的咨詢公司,在對于互聯網的深刻認識的基礎上,依靠長期的經驗,開始為其他客戶進行系統方案的設計和實施,通過建立在與網絡運行商和應用軟件制造商之間的聯盟關系,實現以系統集成商身份出現的ASP提供商。5.ASP的發展歷史與分類
從目前來看,ASP作為一種模式的正式誕生和提出只是在1998年底到1999年初之間的事情。而很大程度上直到1999年末到2000年初,ASP領域相關公司在資本市場上的突出表現才引起了人們的廣泛關注。實際上從ASP模式的內涵和本質上講,并不是全新的事物,而是曾經有過的模式,在互聯網時代被賦予了新的生命力。在本節中,我們將回顧ASP產生發展演變的過程,以幫助更好的深入理解ASP的本質。在最后,我們將集中介紹目前ASP領域內企業從不同標準進行劃分的情況。
HTML 編寫人員 如果您是位 HTML 編寫人員,您將發現 ASP 腳本提供了創建交互頁的簡便方法。如果您曾想從 HTML 表格中收集數據,或用顧客的姓名個人化 HTML 文件,或根據瀏覽器的不同使用不同的特性,您會發現 ASP 提供了一個出色的解決方案。以前,要想從 HTML 表格中收集數據,就不得不學習一門編程語言來創建一個 CGI 應用程序。現在,您只要將一些簡單的指令嵌入到您的 HTML 文件中,就可以從表格中收集數據并進行分析。您再不必學習完整的編程語言或者單獨編譯程序來創建交互頁。東華理工大學畢業設計(外文翻譯)
漢語翻譯
隨著不斷掌握使用 ASP 和腳本語言的技巧,您可以創建更復雜的腳本。對于 ASP,您可以便捷地使用 ActiveX 組件來執行復雜的任務,比如連接數據庫以存儲和檢索信息。
如果您已經掌握一門腳本語言,如 VBScript、JavaScript 或 PERL,而且您已經了解使用 ASP 的方法。只要安裝了符合 ActiveX 腳本標準的相應腳本引擎,就可以在 ASP 頁中使用任何一種腳本語言。ASP 帶有 Microsoft? Visual Basic? Scripting Edition(VBScript)和 Microsoft? Script? 的腳本引擎,這樣您可以立即開始編輯腳本。PERL、REXX 和 Python 的 ActiveX 腳本引擎可以從第三方開發人員處獲得。Web 開發人員 如果您已經掌握了一門編程語言,如 Visual Basic,您將發現 ASP 是快速創建 Web 應用程序的一個非常靈活的方法。通過向 HTML 中添加腳本命令,您能夠創建應用程序的 HTML 接口。通過創建自己的 ActiveX 組件,可以將應用程序中的商業邏輯封裝到能夠從腳本、其他組件或從其他程序中調用的模塊。
使用 ASP 進行計算的 Web 可轉化為有形的利益,它使 Web 供應商能夠提供交互的商業應用而不僅僅是發布內容。例如,旅行社能夠比公布航空時刻表做得更多;用 ASP 腳本可以讓客戶察看現有的航班、比較費用并預定座位。
包含在 Windows NT Option pack 中的 Microsoft Transaction Server(MTS)可以降低在服務器上構造程序的復雜性和費用。TS 可以解決開發那些保密性強的、可分級的
以及可靠的 Web 應用程序的復雜性問題。6.Active Server Pages模型
瀏覽器從 Web 服務器上請求.asp 文件時,然后 Web ASP 腳本開始運行。服務器調用 ASP,執行所有腳本命令,并將 Web 頁ASP 全面讀取請求的文件,傳送給瀏覽器。
由于腳本在服務器上而不是在客戶端運行,傳送到瀏覽器上的 Web 頁是在 Web 服務器上生成的。所以不必擔心瀏覽器能否處理腳本:Web 服務器已經完成了所有腳本的處理,并將標準的 HTML 傳輸到瀏覽器。由于只有腳本的結果返回到瀏覽器,所以服務器端腳本不易復制。用戶看不到創建他們正在瀏覽的頁的腳本命令。
我們將介紹著名數據庫語言的SQL的基本形式。SQL是允許我們查詢和操作關于計算機化的關系數據庫系統的語言。從80 年代初期,SQL就一直是關系數據庫管理系統的語言,而且它是有著重要的意義的在對許多概念中,都在本文 東華理工大學畢業設計(外文翻譯)
漢語翻譯
里提到。當前,SQL語言是從關系形式(ANSI SQL-92 標準)轉向一個新的對象關系形式(ANSI SLQ-99,1999 被發布)。SQL-99 是SQL-92的延伸,它不改變所有早期版本的優秀的語言。通常,我們嚴格定義的基本SQL與ANSI SQL 標準和基礎子集十分類似,分別被認為就是ENTRY SQL-92 和CORE SQL-99。我們也介紹了ENTRY SQL-92、CORE SQL-99之外一些廣泛實現的特性。在定義基本的SQL中,我們的試金石是將提供一種支持大多RDBMS 接口的語法。
首先,我們總的研究SQL的特性,然后對SQL的多種形式標準和產品語言以及我們將如何具體地處理這些標準和產品語言進行分析解釋。
我們知道了怎樣完成關系代數來回應對查詢的數據庫信息。這將讓我們看到,在編寫查詢語句時SQL中的SELECT在很多方面都比關系代數強大。但是,二者在性能上相比較,SQL在本質上并沒有明顯的改進。對那些周密的擴展語法來說,沒有關系代數所不能實現的。所以,關系代數查詢方面的經驗就能成為SQL查詢的很好的借鑒。同時在許多方面,SQL語句和關系代數概念模型又有著相當大的差異,而可以通過熟悉、理解關系代數增強對SQL的理解。
最重要的SQL特性是它擁有在計算機輸出的條件下能夠相互地構造查詢的能力。SQL的SELECT語句比簡單的關系代數更難,但只要能夠上機實踐,只需幾個典型實驗就收回你的懷疑。我們所談論的交互式環境是你在電腦上一輸入一個查詢語句并且立即執行,就可以看到結果。此情況說明了這樣一個事實,一個SQL 的SELECT語句是在打入一些輸入行之后立即形成的,并且對一個用戶來說該語句與前面的任何交互操作都沒有關系。這種不依賴于用戶會話互相通信操作的性質也被稱作非過程性。在這方面SQL也與關系代數不同,因為在關系代數中為了表示一個表與自身的笛卡兒積,在表前面可能需要定義表別名。SQL與比如JAVA或C之類的語言之間的差別十分巨大的:你不需要為了實現一個SQL查詢的功能而編寫一個程序,你只需要量輸入較短的、獨立的查詢語句,然后運行就可以了。
當然,SQL查詢可能會復雜。為此,我們列出了SELECT語句的完整形式。取出這個形式的一個部分的查詢被稱為子查詢,對它的定義是遞歸的,完整的SELECT語句形式只有一個子句。無論如何,你不應恐懼復雜的SQL語句。在使用菜單的應SELECT語句的非過程性說明了它與使用菜單的應用十分相似。用中,用戶需要從菜單中填寫一組數據,然后按下回車來對它們立即執行。但并不是所有SELECT語句的各種子句對于菜單選項有時也會需要所有的子句,的子句在每次查詢的時候都用上。東華理工大學畢業設計(外文翻譯)
漢語翻譯
觀察可靠性應考慮系統使用環境。依照已經討論的內容,系統環境無法預先被描述,系統設計者也不可能對系統工作環境做過多限制。不同的系統對相同環境中的同樣問題還可能有無法預料的反應,所有這些都影響系統的可靠性。因此,即使在系統被集成之后,它的可靠性也是難以精確測量的。7.Visual Basic訪問數據庫的前景:
近來隨著Web應用軟件的迅速發展和現有數據存儲形式的多種多樣,Visual Basic訪問數據庫的解決方案面臨諸如快速提取分布于企業內部和外部有用商業信息等的多種挑戰。為此Microsoft提出一種新的數據庫訪問策略,即“統一數據訪問”(Universal Data Access)的策略。“統一數據訪問”提供了高性能的存取包括關系型和非關系型在內的多種數據源,提供獨立于開發工具和開發語言的簡單的編程接口,這些技術使得企業集成多種數據源、選擇更好的開發工具、應用軟件、操作平臺、建立容易維護的解決方案成為可能。
第二篇:網上選課系統畢業設計總結
網上選課系統總結
1、前言
隨著社會的發展,學生培養計劃已不再一成不變,各個學校紛紛推出了面向全體學生的選課服務,這項旨在為大家提供一個更加寬松自由而且更符合學生意愿的服務已成為當代學生過程中不可缺少的一部分。正式計算機技術的迅速發展使得人們從過去復雜的手工勞動中得以解脫,從而使這種服務在現在才可能迅速普及,同時編寫一套完整的學生信息顯得尤為重要。
2、學生選課管理系統的組成本系統包括首頁,系統公告,學生選課,教師查看,系統管理,系統幫助,聯系我們7個部分。
“首頁”主要是介紹衡水學院的基本情況。
“系統公告”介紹最近的一些新聞和通知,方面同學們及時了解。
“學生選課”是為學生提供選課界面。該界面要列出搜有課程信息供學生查詢和選課。包括未選課程,已選課程,學生選課受一些條件的約束,如課程名額限制,該界面允許學生選課和修改退選。
“教師查看”教師可以查看學生選課情況,有詳細的選課名單。
“系統管理”主要是按指定系檢索該系的學生信息,維護學生,系,課程和學生選課及成績等方面基本信息,包括增加,刪除,修改
“系統幫助”主要是幫助學生能更好及時的完成選課任務。
3、系統實現
采用了ASP.NET結合SQL Server2008數據庫,即將學生選課的有關數據庫存放在選用的SQL Server2008作為后臺的數據庫。
運行環境硬件與網絡環境:用服務器能運行Windows XP及以上操作系統。
第三篇:網上購物系統外文翻譯
重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
重慶三峽學院 畢業設計(論文)
文獻綜述和外文翻譯
設計(論文)題目
網上購物系統設計與實現
學
院:
計算機科學與工程學院
專
業:
軟件工程
年
級:
2008級
姓
名:
肖偉
指導教師:
朱丙麗
完成日期:
2011 年 12 月 29 日 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
文獻綜述
摘要:Servlet程序在服務器端運行,動態地生成Web頁面與傳統的CGI和許多其他類似CGI的技術相比,Java Servlet具有更高的效率,更容易使用,功能更強大,具有更好的可移植性,更節省投資。
關鍵字:JSP技術,Servlet,HTTP服務 1.1Servlet的功能
Servlets是運行在Web或應用服務器上的Java程序,它是一個中間層,負責連接來自Web瀏覽器或其他HTTP客戶程序的請求和HTTP服務器上的數據庫或應用程序。Servlet的工作是執行西門的任務,如圖1.1所示。
圖1.1Web中間件的作用
(1)讀取客戶發送的顯式數據。
最終用戶一般在頁面的HTML表單中輸入這些數據。然而,數據還有可能來自applet或定制的HTTP客戶程序。
(2)讀取由瀏覽器發送的隱式請求數據。
圖1.1中顯示了一條從客戶端到Web服務器的單箭頭,但實際上從客戶端傳送到Web服務器的數據有兩種,它們分別為用戶在表單中輸入的顯式數據,以及后臺的HTTP信息。兩種數據都很重要。HTTP信息包括cookie、瀏覽器所能識別的媒體類型和壓縮模式等。
(3)生成結果。
這個過程可能需要訪問數據庫、執行RMI或EJB調用、調用Web服務,或者直接計算得出對應的響應。實際的數據可能存儲在關系型數據庫中。該數據庫可能不理解HTTP,或者不能返回HTML形式的結果,所有Web瀏覽器不能直接與數據庫進行會話。即使它能夠做到這一點,為了安全上的考慮,我們也不希望讓它這么做。對應大多數其他應用重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
程序,也存在類似的問題。因此,我們需要Web中間層從HTTP流中提取輸入數據,與應用程序會話,并將結果嵌入到文檔中。(4)向客戶發送顯式數據(即文檔)。
這個文檔可以用各種格式發送,包括文本(HTML或XML),二進制(GIF圖),甚至可以式建立在其他底層格式之上的壓縮格式,如gzip。但是,到目前為止,HTML式最常用的格式,故而servelt和JSP的重要任務之一就式將結果包裝到HTML中。(5)發送隱式的HTTP響應數據。
圖1.1中顯示了一條從Web中間層到客戶端的單箭頭。但是,實際發送的數據有兩種:文檔本身,以及后臺的HTTP信息。同樣,兩種數據對開發來說都式至關重要的。HTTP響應數據的發送過程涉及告知瀏覽器或其他客戶程序所返回文檔的類型(如HTML),設置cookie和緩存參數,以及其他類似的任務。1.2動態構建網頁的原因
預先建立的文檔可以滿足客戶的許多請求,服務器無需調用servlet就可以處理這些請求。然而,許多情況下靜態的結果不能滿足要求,我們需要針對每個請求生成一個頁面。實時構建頁面的理由有很多種:
1、網頁基于客戶發送的數據。
例如,搜索引擎生成的頁面,以及在線商店的訂單確認頁面,都要針對特定的用戶請求而產生。在沒有讀取到用戶提交的數據之前,我們不知道應該顯示什么。要記住,用戶提交兩種類型的數據:顯示(即HTML表單的數據)和隱式(即HTTP請求的報頭)。兩種輸入都可用來構建輸出頁面。基于cookie值針對具體用戶構建頁面的情況尤其普遍。
2、頁面由頻繁改變的數據導出。
如果頁面需要根據每個具體的請求做出相應的改變,當然需要在請求發生時構建響應。但是,如果頁面周期性地改變,我們可以用兩種方式來處理它:周期性地在服務器上構建新的頁面(和客戶請求無關),或者僅僅在用戶請求該頁面時再構建。具體應該采用哪種方式要根據具體情況而定,但后一種方式常常更為方便,因為它只需簡單地等待用戶的請求。例如,天氣預報或新聞網站可能會動態地構建頁面,也有可能會返回之前構建的頁面(如果它還是最新的話)。
重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
3、頁面中使用了來自公司數據庫或其他數據庫斷數據源的信息。
如果數據存儲在數據庫中,那么,即使客戶端使用動態Web內容,比如applet,我們依舊需要執行服務器端處理。想象以下,如果一個搜索引擎網站完全使用applet,那么用戶將會看到:“正在下載50TB的applet,請等待!”。顯然,這樣很愚蠢;這種情況下,我們需要與數據庫進行會話。從客戶端到Web層再到數據庫(三層結構),要比從applet直接到數據庫(二層結構)更靈活,也更安全,而性能上的損失很少甚至沒有。畢竟數據庫調用通常是對速度影響最大的步驟,因而,經過中間層可以執行高速緩存和連接共享。
理論上講,servelt并非只用于處理HTTP請求的Web服務器或應用服務器,它同樣可以用于其他類型的服務器。例如,servlet能夠嵌入到FTP或郵件服務器中,擴展他們的功能。而且,用于會話啟動協議服務器的servlet API最近已經被標準化(參見http://jcp.org/en/jsr/detail?id=116)。但在實踐中,servelt的這種用法尚不流行,在此,我們只論述HTTP Servlet。1.3 Servlet相對于“傳統”CGI的優點
和傳統CGI及許多類CGI技術相比,Java servelt效率更高、更易用、更強大、更容易移植、更安全、也更廉價。
1、效率
應用傳統的CGI,針對每個HTTP請求都用啟動一個新的進程。如果CGI程序自身相對比較簡短,那么啟動進程的開銷會占用大部分執行時間。而使用servelt,Java虛擬機會一直運行,并用輕量級的Java線程處理每個請求,而非重量級的操作系統進程。類似地,應用傳統的CGI技術,如果存在對同一CGI程序的N個請求,那么CGI程序的代碼會載入內存N次。同樣的情況,如果使用servlet則啟動N個線程,單僅僅載入servlet類的單一副本。這種方式減少了服務器的內存需求,通過實例化更少的對象從而節省了時間。最后,當CGI程序結束對請求的處理之后,程序結束。這種方式難以緩存計算結果,保持數據庫連接打開,或是執行依靠持續性數據的其他優化。然而,servelt會一直停留在內存中(即使請求處理完畢),因而可以直接存儲客戶請求之間的任意復雜數據。
2、便利
Servelt提供大量的基礎構造,可以自動分析和解碼HTML的表單數據,讀取和設置 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
HTTP報頭,處理cookie,跟蹤會話,以及其他次類高級功能。而在CGI中,大部分工作都需要我們資金完成。另外,如果您已經了解了Java編程語言,為什么還有學校Perl呢?您已經承認應用Java技術編寫的代碼要比Visual Basic,VBScript或C++編寫的代碼更可靠,且更易重用,為什么還有倒退回去選擇那些語言來開發服務器端的程序呢?
3、強大
Servlet支持常規CGI難以實現或根本不能實現的幾項功能。Servlet能夠直接于Web服務器對話,而常規的CGI程序做不到這一點,至少在不使用服務器專有API的情況下是這樣。例如,與Web服務器的通信使得講相對URL轉換成具體的路徑名變得更為容易。多個servelt還可以共享數據,從而易于實現數據庫連接共享和類似的資源共享優化。Servelt還能維護請求之間的信息,使得諸如會話跟蹤和計算結果緩存等技術變得更為簡單。
4、可移植性
Servelt使用Java編程語言,并且遵循標準的API。所有主要的Web服務器。實際上都直接或通過插件支持servlet。因此。為Macromedia JRun編寫的servlet,可以不經過任何修改地在Apache Tomcat,Microsoft Internet Information Server,IBM WebSphere。iPlanet Enterprise Server。Oracle9i AS 或者StrNine WebStar上運行。他們是java2平臺企業版的一部分,所以對servlet的支持越來越普遍。
5、廉價
對于開發用的網站、低容量或中等容量網站的部署,有大量免費或極為廉價的Web服務器可供選擇。因此,通過使用servelt和jsp,我們可以從免費或廉價的服務器開始,在項目獲得初步成功后,在移植到更高性能或高級管理工具的昂貴的服務器上。這與其他CGI方案形成鮮明的對比,這些CGI方案在初期都需要為購買專利軟件包投入大量的資金。
價格和可移植性在某種程度上是相互關聯的。例如,Marty記錄了所有通過電子郵件向他發送問題的讀者的所在國。印度接近列表的頂端,可能僅次于美國。Marty曾在馬尼拉講授過jsp和servlet培訓課程,那兒對servelt和jsp技術抱很大的興趣。
那么,為什么印度和菲律賓都對這項技術著呢感興趣呢?我們推測答案可能分兩部分。首先,這兩個國家都擁有大量訓練有素的軟件開發人員。其次,這兩個國家的貨幣
重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
對美元的匯率都極為不利。因此,從美國公司那里購買專用Web服務器會消耗掉項目的大部分前期資金。
但是,使用servlet 和JSP,他們能夠從免費的服務器開始:Apache Tomcat。項目取得成功之后,他們可以轉移到性能更高、管理更容易,但需要付費的服務器。他們的servelt和jsp不需要重寫編寫。如果他們的項目變得更龐大,他們或許希望轉移到分布式環境。沒有問題:他們可以轉而使用Macromedia JRun Professional,該服務器支持分布式應用。同樣,他們的servelt和jsp沒有任何部分需要重寫。如果項目變得極為龐大,錯綜復雜,他們或許希望使用Enterprise JavaBeans來封裝他們的商業邏輯。因此,他們可以切換到BEA WebLogic或Oracle9i AS。同樣,不需要對servlet和jsp做出更改。最后,如果他們的項目變得更龐大,他們或許將他從Linux轉移到運行IBM WebSphere的IBM大型機上。他們還是不需要做出任何更改。
6、安全
傳統CGI程序中主要的漏洞來源之一就是,CGI程序常常由通過的操作系統外殼來執行。因此,CGI程序必須仔細地過濾掉那些可能被外殼特殊處理的字符,如反引導和分號。實現這項預防措施的難度可能超出我們的想象,在廣泛應用的CGI庫中,不斷發現由這類問題引發的弱點。
問題的第二個來源是,一些CGI程序用不自動檢查數組和字符串邊界的語言編寫而成。例如,在C和C++中,可以分配一個100個元素的數組,然后向第999個“元素“寫入數據——實際上是程序內存的隨機部分,這完全合法。因而,如果程序員忘記執行這項檢查,就會將系統暴露在蓄意或偶然的緩沖區溢出攻擊之下。
Servelt不存在這些問題。即使servelt執行系統調用激活本地操作系統上的程序,它也不會用到外殼來完成這項任務。當然,數組邊界的檢查以及其他內存包含特性是java編程語言的核心部分。
7、主流
雖然存在許多很好的技術,但是,如果提供商助支持他們,或開發人員不知道如何使用這些技術,那么它們的優點又如何體現呢?servelt和jsp技術得到服務器提供商的廣泛支持,包括Apache,Oracle,IBM,Sybase,BEA,Maromedia,Causho,Sun/iPlanet,New Atlanta,ATG,Fujitsu,Lutris,Silverstream,World Wide Web Consortinrm,以及其他服務器。存在幾種低廉的插件,通過應用這些插件,Microsoft IIS和Zeus 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
也同樣支持servlet和jsp技術,它們運行在Windows,Unix/Linus,MacOS,VMS,和IBM大型機操作系統之上。它們用在航空業、電子商務、在線銀行、web搜索引擎、門戶、大型金融網站、以及成百上千您日常光顧的其他網站。
當然,僅僅是流行并不能證明技術的優越性。很多泛美的例子。但我們的立場是:服務器端Java本非一項新的、為經證實的技術。
An Overview of Servlet and JSP Technology Abstract: Servlet program running in the server-side, dynamically generated Web page with the traditional CGI and many other similar compared to CGI technology, Java Servlet with a more efficient, easier to use, more powerful and has better portability, more savings to invest.Key words: JSP Technology, Servlet, HTTP server
1.1 A Servlet's Job Servlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server.Their job is to perform the following tasks, as illustrated in Figure 1-1.Figure 1-1 1.Read the explicit data sent by the client.The end user normally enters this data in an HTML form on a Web page.However, the data could also come from an applet or a custom HTTP client program.2.Read the implicit HTTP request data sent by the browser.Figure 1-1 shows a single arrow going from the client to the Web server(the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information.Both varieties are critical.The HTTP information includes cookies, information about media types and compression schemes the browser understands, and so on.3.Generate the results.This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or computing the response directly.Your real data may be in a relational database.Fine.But your database probably doesn't speak HTTP or return results in HTML, so the Web browser can't talk directly to the database.6 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
Even if it could, for security reasons, you probably would not want it to.The same argument applies to most other applications.You need the Web middle layer to extract the results inside a document.4.Send the explicit data(i.e., the document)to the client.This document can be sent in a variety of formats, including text(HTML or XML), binary(GIF images), or even a compressed format like gzip that is layered on top of some other underlying format.But, HTML is by far the most common format, so an important servlet/JSP task is to wrap the results inside of HTML.5.Send the implicit HTTP response data.Figure 1-1 shows a single arrow going from the Web middle layer(the servlet or JSP page)to the client.But, there are really two varieties of data sent: the document itself and the behind-the-scenes HTTP information.Again, both varieties are critical to effective development.Sending HTTP response data involves telling the browser or other client what type of document is being returned(e.g., HTML), setting cookies and caching parameters, and other such tasks.1.2 Why Build Web Pages Dynamically? many client requests can be satisfied by prebuilt documents, and the server would handle these requests without invoking servlets.In many cases, however, a static result is not sufficient, and a page needs to be generated for each request.There are a number of reasons why Web pages need to be built on-the-fly: 1. The Web page is based on data sent by the client.For instance, the results page from search engines and order-confirmation pages at online stores are specific to particular user requests.You don't know what to display until you read the data that the user submits.Just remember that the user submits two kinds of data: explicit(i.e., HTML form data)and implicit(i.e., HTTP request headers).Either kind of input can be used to build the output page.In particular, it is quite common to build a user-specific page based on a cookie value.2.The Web page is derived from data that changes frequently.If the page changes for every request, then you certainly need to build the response at request time.If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server(independently of client requests), or you could wait and only build the page when the user requests it.The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request.For example, a weather report or news headlines site might build the pages dynamically, perhaps returning a previously built page if that page is still up to date.重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
3.The Web page uses information from corporate databases or other server-side sources.If the information is in a database, you need server-side processing even if the client is using dynamic Web content such as an applet.Imagine using an applet by itself for a search engine site: “Downloading 50 terabyte applet, please wait!” Obviously, that is silly;you need to talk to the database.Going from the client to the Web tier to the database(a three-tier approach)instead of from an applet directly to a database(a two-tier approach)provides increased flexibility and security with little or no performance penalty.After all, the database call is usually the rate-limiting step, so going through the Web server does not slow things down.In fact, a three-tier approach is often faster because the middle tier can perform caching and connection pooling.In principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as well.For example, servlets could be embedded in FTP or mail servers to extend their functionality.And, a servlet API for SIP(Session Initiation Protocol)servers was recently standardized(see http://jcp.org/en/jsr/detail?id=116).In practice, however, this use of servlets has not caught on, and we'll only be discussing HTTP servlets.1.3 The Advantages of Servlets Over “Traditional” CGI Java servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies.1.Efficient With traditional CGI, a new process is started for each HTTP request.If the CGI program itself is relatively short, the overhead of starting the process can dominate the execution time.With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process.Similarly, in traditional CGI, if there are N requests to the same CGI program, the code for the CGI program is loaded into memory N times.With servlets, however, there would be N threads, but only a single copy of the servlet class would be loaded.This approach reduces server memory requirements and saves time by instantiating fewer objects.Finally, when a CGI program finishes handling a request, the program terminates.This approach makes it difficult to cache computations, keep database connections open, and perform other optimizations that rely on persistent data.Servlets, however, remain in memory even after they complete a response, so it is straightforward to store arbitrarily complex data between client requests.2.Convenient Servlets have an extensive infrastructure for automatically parsing and
重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities.In CGI, you have to do much of this yourself.Besides, if you already know the Java programming language, why learn Perl too? You're already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++.Why go back to those languages for server-side programming? 3.Powerful Servlets support several capabilities that are difficult or impossible to accomplish with regular CGI.Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API.Communicating with the Web server makes it easier to translate relative URLs into concrete path names, for instance.Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations.Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.4.Portable Servlets are written in the Java programming language and follow a standard API.Servlets are supported directly or by a plugin on virtually every major Web server.Consequently, servlets written for, say, Macromedia JRun can run virtually unchanged on Apache Tomcat, Microsoft Internet Information Server(with a separate plugin), IBM WebSphere, iPlanet Enterprise Server, Oracle9i AS, or StarNine WebStar.They are part of the Java 2 Platform, Enterprise Edition(J2EE;see http://java.sun.com/j2ee/), so industry support for servlets is becoming even more pervasive.5.Inexpensive A number of free or very inexpensive Web servers are good for development use or deployment of low-or medium-volume Web sites.Thus, with servlets and JSP you can start with a free or inexpensive server and migrate to more expensive servers with high-performance capabilities or advanced administration utilities only after your project meets initial success.This is in contrast to many of the other CGI alternatives, which require a significant initial investment for the purchase of a proprietary package.Price and portability are somewhat connected.For example, Marty tries to keep track of the countries of readers that send him questions by email.India was near the top of the list, probably #2 behind the U.S.Marty also taught one of his JSP and servlet training courses(see http://courses.coreservlets.com/)in Manila, and there was great interest in servlet and JSP technology there.Now, why are India and the Philippines both so interested? We surmise that the answer is twofold.First, both countries have large pools of well-educated software developers.Second, both countries have(or had, at that time)highly 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
unfavorable currency exchange rates against the U.S.dollar.So, buying a special-purpose Web server from a U.S.company consumed a large part of early project funds.But, with servlets and JSP, they could start with a free server: Apache Tomcat(either standalone, embedded in the regular Apache Web server, or embedded in Microsoft IIS).Once the project starts to become successful, they could move to a server like Caucho Resin that had higher performance and easier administration but that is not free.But none of their servlets or JSP pages have to be rewritten.If their project becomes even larger, they might want to move to a distributed(clustered)environment.No problem: they could move to Macromedia JRun Professional, which supports distributed applications(Web farms).Again, none of their servlets or JSP pages have to be rewritten.If the project becomes quite large and complex, they might want to use Enterprise JavaBeans(EJB)to encapsulate their business logic.So, they might switch to BEA WebLogic or Oracle9i AS.Again, none of their servlets or JSP pages have to be rewritten.Finally, if their project becomes even bigger, they might move it off of their Linux box and onto an IBM mainframe running IBM WebSphere.But once again, none of their servlets or JSP pages have to be rewritten.6.Secure One of the main sources of vulnerabilities in traditional CGI stems from the fact that the programs are often executed by general-purpose operating system shells.So, the CGI programmer must be careful to filter out characters such as backquotes and semicolons that are treated specially by the shell.Implementing this precaution is harder than one might think, and weaknesses stemming from this problem are constantly being uncovered in widely used CGI libraries.A second source of problems is the fact that some CGI programs are processed by languages that do not automatically check array or string bounds.For example, in C and C++ it is perfectly legal to allocate a 100-element array and then write into the 999th “element,” which is really some random part of program memory.So, programmers who forget to perform this check open up their system to deliberate or accidental buffer overflow attacks.Servlets suffer from neither of these problems.Even if a servlet executes a system call(e.g., with Runtime.exec or JNI)to invoke a program on the local operating system, it does not use a shell to do so.And, of course, array bounds checking and other memory protection features are a central part of the Java programming language.7.Mainstream There are a lot of good technologies out there.But if vendors don't support them and developers don't know how to use them, what good are they? Servlet and JSP technology is supported by servers from Apache, Oracle, IBM, Sybase, BEA,10 重慶三峽學院畢業設計外文翻譯[肖偉]-網上購物系統設計與實現
Macromedia, Caucho, Sun/iPlanet, New Atlanta, ATG, Fujitsu, Lutris, Silverstream, the World Wide Web Consortium(W3C), and many others.Several low-cost plugins add support to Microsoft IIS and Zeus as well.They run on Windows, Unix/Linux, MacOS, VMS, and IBM mainframe operating systems.They are the single most popular application of the Java programming language.They are arguably the most popular choice for developing medium to large Web applications.They are used by the airline industry(most United Airlines and Delta Airlines Web sites), e-commerce(ofoto.com), online banking(First USA Bank, Banco Popular de Puerto Rico), Web search engines/portals(excite.com), large financial sites(American Century Investments), and hundreds of other sites that you visit every day.Of course, popularity alone is no proof of good technology.Numerous counter-examples abound.But our point is that you are not experimenting with a new and unproven technology when you work with server-side Java.
第四篇:畢業設計外文翻譯
外文原文
Overview of JSp Technology
Benefits of JSp
JSp pages are translated into servlets.So, fundamentally, any task JSp pages can perform could also be accomplished by servlets.However, this underlying equivalence does not mean that servlets and JSp pages are equally appropriate in all scenarios.The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other.After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language.But it still matters which you choose.JSp provides the following benefits over servlets alone:
?It is easier to write and maintain the HTML.Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.?You can use standard Web-site development tools.Even HTML tools that know nothing about JSp can be used because they simply ignore the JSp tags.?You can divide up your development team.The Java programmers can work on the dynamic code.The Web developers can concentrate on the presentation layer.On large projects, this division is very important.Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSp instead.By no means.Almost all projects will use both.For some requests in your project, you will use servlets.For others, you will use JSp.For still others, you will combine them with the MVC architecture.You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.Advantages of JSp Over Competing Technologies
A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology.Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language.Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington.During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology.The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea.He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual “embrace and extend” strategy.At this point, Gosling lightheartedly interjected “You mean disgrace and distend.”
Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their own purposes.But guess what? The shoe is on the other foot here.The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags.For example, ColdFusion did it years earlier.Even ASp(a product from the very software company of the aforementioned manager)popularized this approach before JSp came along and decided to jump on the bandwagon.In fact, JSp not only adopted the general idea, it even used many of the same special tags as ASp did.So, the question becomes: why use JSp instead of one of these other technologies? Our first response is that we are not arguing that everyone should.Several of those other technologies are quite good and are reasonable options in some situations.In other situations, however, JSp is clearly better.Here are a few of the reasons.Versus.NET and Active Server pages(ASp)
.NET is well-designed technology from Microsoft.ASp.NET is the part that directly competes with servlets and JSp.The advantages of JSp are twofold.First, JSp is portable to multiple operating systems and Web servers;you aren't locked into deploying on Windows and IIS.Although the core.NET platform runs on a few non-Windows platforms, the ASp part does not.You cannot expect to deploy serious ASp.NET applications on multiple servers and operating systems.For some applications, this difference does not matter.For others, it matters greatly.Second, for some applications the choice of the underlying language matters greatly.For example, although.NET's C# language is very well designed and is similar to Java, fewer programmers are familiar with either the core C# syntax or the many auxiliary libraries.In addition, many developers still use the original version of ASp.With this version, JSp has a clear advantage for the dynamic code.With JSp, the dynamic part is written in Java, not VBScript or another ASp-specific language, so JSp is more powerful and better suited to complex applications that require reusable components.You could make the same argument when comparing JSp to the previous version of ColdFusion;with JSp you can use Java for the “real code” and are not tied to a particular server product.However, the current release of ColdFusion is within the context of a J2EE server, allowing developers to easily mix ColdFusion and servlet/JSp code.Versus pHp
pHp(a recursive acronym for “pHp: 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 pHp.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.Does this mean that you can just learn JSp and forget about servlets? Absolutely not!JSp developers need to 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 JavaScript
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.Versus WebMacro or Velocity
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.Besides, the tremendous industry support for JSp and servlet technology results in improvements that mitigate many of the criticisms of JSp.For example, the JSp Standard Tag Library and the JSp 2.0 expression language address two of the most well-founded criticisms: the lack of good iteration constructs and the difficulty of accessing dynamic results without using either explicit Java code or verbose jsp:useBean elements.10.4 Misconceptions About JSp
Forgetting JSp Is Server-Side Technology
Here are some typical questions Marty has received(most of them repeatedly).?Our server is running JDK 1.4.So, how do I put a Swing component in a JSp page?
?How do I put an image into a JSp page? I do not know the proper Java I/O commands to read image files.?Since Tomcat does not support JavaScript, how do I make images that are highlighted when the user moves the mouse over them?
?Our clients use older browsers that do not understand JSp.What should we do?
?When our clients use “View Source” in a browser, how can I prevent them from seeing the JSp tags?
All of these questions are based upon the assumption that browsers know something about the server-side process.But they do not.Thus:
?For putting applets with Swing components into Web pages, what matters is the browser's Java version—the server's version is irrelevant.If the browser supports the Java 2 platform, you use the normal AppLET(or Java plug-in)tag and would do so even if you were using non-Java technology on the server.?You do not need Java I/O to read image files;you just put the image in the directory for Web resources(i.e., two levels up from WEB-INF/classes)and output a normal IMG tag.?You create images that change under the mouse by using client-side JavaScript, referenced with the SCRIpT tag;this does not change just because the server is using JSp.?Browsers do not “support” JSp at all—they merely see the output of the JSp page.So, make sure your JSp outputs HTML compatible with the browser, just as you would do with static HTML pages.?And, of course you need not do anything to prevent clients from seeing JSp tags;those tags are processed on the server and are not part of the output that is sent to the client.Confusing Translation Time with Request Time
A JSp page is converted into a servlet.The servlet is compiled, loaded into the server's memory, initialized, and executed.But which step happens when? To answer that question, remember two points:
?The JSp page is translated into a servlet and compiled only the first time it is accessed after having been modified.?Loading into memory, initialization, and execution follow the normal rules for servlets.Table 1 gives some common scenarios and tells whether or not each step occurs in that scenario.The most frequently misunderstood entries are highlighted.When referring to the table, note that servlets resulting from JSp pages use the _jspService method(called for both GET and pOST requests), not doGet or dopost.Also, for initialization, they use the jspInit method, not the init method.Table 1.JSp Operations in Various Scenarios
JSp page translated into servletServlet compiledServlet loaded into server's memoryjspInit called_jspService called
page first written
Request 1YesYesYesYesYes
Request 2NoNoNoNoYes
Server restarted
Request 3NoNoYesYesYes
Request 4NoNoNoNoYes
page modified
Request 5YesYesYesYesYes
Request 6NoNoNoNoYes
中文翻譯
JSp技術概述
一、JSp的好處
JSp頁面最終會轉換成servler。因而,從根本上,JSp頁面能夠執行的任何任務都可以用servler來完成。然而,這種底層的等同性并不意味著servler和JSp頁面對于所有的情況都等同適用。問題不在于技術的能力,而是二者在便利性、生產率和可維護性上的不同。畢竟,在特定平臺上能夠用Java編程語言完成的事情,同樣可以用匯編語言來完成,但是選擇哪種語言依舊十分重要。
和單獨使用servler相比,JSp提供下述好處:
?JSp中HTML的編寫與維護更為簡單。JSp中可以使用常規的HTML:沒有額外的反斜杠,沒有額外的雙引號,也沒有暗含的Java語法。
?能夠使用標準的網站開發工具。即使對那些對JSp一無所知的HTML工具,我們也可以使用,因為它們會忽略JSp標簽(JSp tags)。
?可以對開發團隊進行劃分。Java程序員可以致力于動態代碼。Web開發人員可以將經理集中在表示層(presentation layer)上。對于大型的項目,這種劃分極為重要。依據開發團隊的大小,及項目的復雜程度,可以對靜態HTML和動態內容進行弱分離(weaker separation)和強分離(stronger separation)。
在此,這個討論并不是讓您停止使用servlets,只使用JSp。幾乎所有的項目都會同時用到這兩種技術。針對項目中的某些請求,您可能會在MVC構架下組合使用這兩項技術。我們總是希望用適當的工具完成相對應的工作,僅僅是servlet并不能填滿您的工具箱。
二、JSp相對于競爭技術的優勢
許多年前,Marty受到邀請,參加一個有關軟件技術的小型(20個人)研討會.做在Marty旁邊的人是James Gosling---Java編程語言的發明者。隔幾個位置,是來自華盛頓一家大型軟件公司的高級經理。在討論過程中,研討會的主席提出了Jini的議題,這在當時是一項新的Java技術.主席向該經理詢問他的想法.他繼續說,他們會持續關注這項技術,如果這項技術變得流行起來,他們會遵循公司的“接受并擴充(embrace and extend)”的策略.此時, Gosling隨意地插話說“你的意思其實就是不接受且不擴充(disgrace and distend)。”
在此, Gosling的抱怨顯示出,他感到這個公司會從其他公司那里拿走技術,用于他們自己的目的.但你猜這次怎么樣?這次鞋子穿在了另一只腳上。Java社團沒有發明這一思想----將頁面設計成由靜態HTML和用特殊標簽標記的動態代碼混合組成.。ColdFusion多年前就已經這樣做了。甚至ASp(來自于前述經理所在公司的一項產品)都在JSp出現之前推廣了這種方式。實際上,JSp不只采用了這種通用概念,它甚至使用許多和ASp相同的特殊標簽。
因此,問題變成:為什么使用JSp,而不使用其他技術呢?我們的第一反應是我們不是在爭論所有的人應該做什么。其他這些技術中,有一些也很不錯,在某些情況下也的確是合情合理的選擇.然而,在其他情形中,JSp明顯要更好一些。下面給出幾個理由。
與.NET和Active Server pages(ASp)相比
.NET是Microsoft精心設計的一項技術。ASp.NET是與servlets和JSp直接競爭的技術。JSp的優勢體現在兩個方面。
首先,JSp可以移植到多種操作系統和Web服務器,您不必僅僅局限于部署在Windows 和IIS上盡管核心.NET平臺可以在好幾種非Windows平臺上運行,但ASp這一部分不可以。您不能期望可以將重要的ASp.NET應用部署到多種服務器和操作系統。對于某些應用,這種差異沒有什么影響。但有些應用,這種差異卻非常重要。
其次,對于某些應用,底層語言的選擇至關重要。例如,盡管.NET的C#語言設計優良,且和Java類似,但熟悉核心C#語法和眾多工具庫的程序員很少。此外,許多開發者依舊使用最初版本的ASp。相對于這個版本,JSp在動態代碼方面擁有明顯的優勢。使用JSp,動態部分是用Java編寫的,而非VBScript過其他ASp專有的語言,因此JSp更為強勁,更適合于要求組件重用的復雜應用。
當將JSp與之前版本的ColdFusion對比時,您可能會得到相同的結論。應用JSp,您可以使用Java編寫“真正的代碼”,不必依賴于特定的服務器產品。然而,當前版本的ColdFusion滿足J2EE服務器的環境,允許開發者容易的混合使用ColdFusion和Servlet/JSp代碼。
與pHp相比
pHp(“pHp:Hypertext preprocessor”的遞歸字母縮寫詞)是免費的、開放源代碼的、HTML嵌入其中的腳本語言,與ASp和JSp都有某種程度的類似。JSp的一項優勢是動態部分用Java編寫,而Java已經在聯網、數據庫訪問、分布式對象等方面擁有廣泛的ApI,而pHp需要學習全新的、應用相對廣泛的語言。JSp的第二項優勢是,和pHp相比,JSp擁有極為廣泛的工具和服務器提供商的支持。
與純Servlet相比
原則上,JSp并沒有提供Servlet不能完成的功能。實際上,JSp文檔在后臺被自動轉換成Servlet。但是編寫(和修改)常規的HTML,要比無數println語句生成HTML要方便得多。另外,通過將表示與內容分離,可以為不同的人分配不同的任務:網頁設計人員使用熟悉的工具構建HTML,要么為Servlet程序員留出空間插入動態內容,要么通過XML標簽間接調用動態內容。
這是否表示您只可以學習JSp,將Servlet丟到一邊呢?當然不是!由于以下4種原因,JSp開發人員需要了解Servlet:
(1)JSp頁面會轉換成Servlet。不了解Servlet就無法知道JSp如何工作。
(2)JSp由靜態HTML、專用的JSp標簽和Java代碼組成。哪種類型的Java代碼呢?當然是Servlet代碼!如果不了解Servlet編程,那么就無法編寫這種代碼。
(3)一些任務用Servlet完成比用JSp來完成要好。JSp擅長生成由大量組織有序的結構化HTML或其他字符數據組成的頁面。Servlet擅長生成二進制數據,構建結構多樣的頁面,以及執行輸出很少或者沒有輸出的任務(比如重定向)。
(4)有些任務更適合于組合使用Servlet和JSp來完成,而非單獨使用Servlet或JSp。
與JavaScript相比
JavaScript和Java編程語言完全是兩碼事,前者一般用于在客戶端動態生成HTML,在瀏覽器載入文檔時構建網頁的部分內容。這是一項有用的功能,一般與JSp的功能(只在服務器端運行)并不發生重疊。和常規HTML頁面一樣,JSp頁面依舊可以包括用于JavaScript的SCRIpT標簽。實際上,JSp甚至能夠用來動態生成發送到客戶端的JavaScript。因此,JavaScript不是一項競爭技術,它是一項補充技術。
JavaScript也可以用在服務器端,最因人注意的是SUN ONE(以前的iplanet)、IIS和BroadVision服務器。然而,Java更為強大靈活、可靠且可移植。
與WebMacro和Velocity相比
JSp決非完美。許多人都曾指出過JSp中能夠改進的功能。這是一件好事,JSp的優勢之一是該規范由許多不同公司組成的社團控制。因此,在后續版本中,這項技術能夠得到協調的改進。
但是,一些組織已經開發出了基于Java的替代技術,試圖彌補這些不足。據我們的判斷,這樣做是錯誤的。使用擴充JSp和Servlet技術的第三方工具,如Apache Structs,是一種很好的思路,只要該工具帶來的好處能夠補償工具帶來的額外復雜性。但是,試圖使用非標準的工具代替JSp則不理想。在選擇一項技術時,需要權衡許多方面的因素:標準化、可移植性、集成性、行業支持和技術特性。對于JSp替代技術的爭論幾乎只是集中在技術特性上,而可移植性、標準化和集成性也十分重要。例如,Servlet和JSp規范為Web應用定義了一個標準的目錄結構,并提供用于部署Web應用的標準文件(.war文件)。所有JSp兼容的服務器必須支持這些標準。我們可以建立過濾器作用到任意樹木的Servlet和JSp頁面上,但不能用于非標準資源。Web應用安全設置也同樣如此。
此外,業界對JSp和Servlet技術的巨大支持使得這兩項技術都有了巨大的進步,從而減輕了對JSp的許多批評。例如,JSp標準標簽庫和JSp 2.0表達式語言解決了兩種最廣泛的批評:缺乏良好的迭代結構;不使用顯式的Java代碼或冗長的jsp:useBean元素難以訪問動態結果。
三、對JSp的誤解
忘記JSp技術是服務器端技術
下面是Marty收到的一些典型問題(大部分問題不止一次的出現)。
?我們的服務器正在運行JDK1.4。我如何將Swing組件用到JSp頁面中呢?
?我如何將圖像放到JSp頁面中?我不知道讀取圖像文件應該使用哪些Java I/O命令。
?Tomcat不支持JavaScript,當用戶在圖像上移動鼠標時,我如何使圖像突出顯示呢?
?我們的客戶使用不理解JSp的舊瀏覽器。我應該怎么做?
?當我們的客戶在瀏覽器中使用“View Source”(查看源代碼)時,如何阻止他們看到JSp標簽?
所有這些問題都基于瀏覽器對服務器端的過程在有所了解的假定之上。但事實上瀏覽器并不了解服務器端的過程。因此:
?如果要將使用Swing組件的applet放到網頁中,重要的是瀏覽器的Java版本,和服務器的Java版本無關。如果瀏覽器支持Java 2平臺,您可以使用正常的AppLET(或Java插件)標簽,即使在服務器上使用了非Java技術也須如此。
?您不需要Java I/O來讀取圖像文件,您只需將圖像放在存儲Web資源的目錄中(即WEB-INF/classes向上兩級的目錄),并輸出一個正常的IMG標簽。
?您應該用SCRIpT標簽,使用客戶端JavaScript創建在鼠標下會更改的圖像,這不會由于服務器使用JSp而改變。
?瀏覽器根本不“支持”JSp----它們看到的只是JSp頁面的輸出。因此,如同對待靜態HTML頁面一樣,只需確保JSp輸出的HTML與瀏覽器兼容。
?當然,您不需要采取什么措施來阻止客戶看到JSp標簽,這些標簽在服務器上進行處理,發送給客戶的輸出中并不出現。
混淆轉換期間和請求期間
JSp頁面需要轉換成servlet。Servlet在編譯后,載入到服務器的內容中,初始化并執行。但是每一步發生在什么時候呢?要回答這個問題,要記住以下兩點:
?JSp頁面僅在修改后第一次被訪問時,才會被轉換成servlet并進行編譯;
?載入到內存中、初始化和執行遵循servlet的一般規則。
表1列出一些常見的情形,講述在該種情況下每一步是否發生。最常被誤解的項已經突出標示出來。在參考該表時,要注意,由JSp頁面生成的servlet使用_jspService方法(GET和pOST請求都調用該函數),不是doGet或dopost方法。同樣,對于初始化,它們使用jspInit方法,而非init方法。
表1 各種情況下的JSp操作
將JSp 頁面轉換成servlet編譯Servlet 將Servlet 載入到服務器內存中調用jspInit 調用_jspService
頁面初次創建
請求 1有有有有有
請求 2無無無無有
服務器重啟后
請求3無無有有有
請求 4無無無無有
頁面修改后
請求 5有有有有有
請求 6無無無無有
第五篇:基于ASP的網上書店系統畢業設計任務書
畢業設計任務書
基于ASP的網上書店系統畢業設計任務書
指導教師:李芳瑩設計日期:2011年11月28日-2012年2月7日
一、設計題目:
基于ASP的網上書店系統
二、設計任務要求
1、系統設計環境
(1)操作系統:Windows 2000、Windows XP、vista、7操作系統。
(2)使用語言:ASP、HTML;
(3)使用數據庫:ACCESS、SQL SERVER;
2、熟悉軟件工程的各個過程,熟悉軟件測試和數據庫測試的方法。
3、掌握系統設計,數據庫設計常用的方法。
4、掌握數據庫的安裝和網絡配置的方法。
5、程序代碼編寫要規范。
6、掌握腳本的生成方法和幫助文件的生成方法。
7、熟悉電子商務的基本知識,掌握常用B/S系統的設計、編寫方法。
8、重點放在網站的設計,而不是網頁設計上。
三、設計進度及安排
1、需求分析階段(1周)
2、系統規化設計階段(3周)
3、畢業設計階段(3周)
4、畢業答辯階段(1周)
四、設計成品要求
1、軟件實際上機運行,實現基本功能,并且有一定可擴展性。
2、設計成果存入光盤。
3、畢業設計論文。