计算机类外文翻译.pdf

上传人:蓝**** 文档编号:90993126 上传时间:2023-05-19 格式:PDF 页数:10 大小:504.42KB
返回 下载 相关 举报
计算机类外文翻译.pdf_第1页
第1页 / 共10页
计算机类外文翻译.pdf_第2页
第2页 / 共10页
点击查看更多>>
资源描述

《计算机类外文翻译.pdf》由会员分享,可在线阅读,更多相关《计算机类外文翻译.pdf(10页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、外文原文Introducing JSP、JAVA、TomcatBy:Gary H.Sockut,Balakrishna R.IyerSource:Beginning JSP,JSF and TomcatIntroducing JSP and TomcatInteractivity is what makes the Web really useful.By interacting with a remote server,you can findthe information you need,keep in touch with your friends,or purchase someth

2、ingonline.And everytime you type something into a web form,an application“out there”interprets your request and prepares a web page to respond.1.Installing JavaJavaServer Pages(JSP)is a technology that helps you create such dynamically generatedpages by converting script files into executable Java m

3、odules;JavaServer Faces(JSF)is apackage that facilitates interactivity with the page viewers;and Tomcat is an application thatcan execute your code and act as a web server for your dynamic pages.Everything you need to develop JSP/JSF web applications is available for free downloadfrom the Internet;b

4、ut to install all the necessary packages and tools and obtain an integrateddevelopment environment,you need to proceed with care.There is nothing more annoyingthan having to deal with incorrectly installed software.When something doesnt work,theproblem will always be difficult to find.In this chapte

5、r,Ill introduce you to Java servlets and JSP,and Ill show you how theywork together within Tomcat to generate dynamic web pages.But,first of all,I will guide youthrough the installation of Java and Tomcat:there wouldnt be much point in looking at codeyou cant execute on your PC,would there?Youll hav

6、e to install more packages as you progress.Do these installations correctly,and you will never need to second guess yourself.In total,you will need at least 300MB ofdisk space for Java and Tomcat alone and twice as much space to install the Eclipsedevelopment environment.To run all the examples cont

7、ained in this book,I used a PC with a2.6GHz AMD Athlon 64x2(nothing fancy,nowadays)with 1GB of memory and runningWindows Vista SP2.Before performing any installation,I reformatted the hard disk andre-installed the OS from the original DVD.I dont suggest for a moment that you do the same!I did it for

8、 two opposite butequally important reasons:first,I didnt want existing stuff tointerfere with the latest packages needed for web development;second,I didnt want to relyon anything already installed.I wanted to be sure to give you the full list of what you need.12.Installing TomcatThis is the Java we

9、b server,which is the servlet container that allows you to run JSP.Ifyou have already installed an older version of Tomcat,you should remove it before installinga new version.Tomcat listens to three communication ports of your PC(8005,8009,and 8080).Beforeyou install Tomcat,you should check whether

10、some already-installed applications arelistening to one or more of those ports.To do so,open a DOS window and type the commandnetstat/a.It will display a list of active connections in tabular form.The second column of thetable will look like this:Local Address0.0.0.0:1350.0.0.0:4450.0.0.0:3306The po

11、rt numbers are the numbers after the colon.If you see one or more of the portsTomcat uses,after installing Tomcat,you will have to change the ports it listens to.Heres howto install Tomcat 7 correctly:(1).Go to the URL http:/tomcat.apache.org/download-70.cgi.Immediatelybelow the second heading(“Quic

12、k Navigation”),you will see four links:KEYS,7.0.26,Browse,and Archives.(2).By clicking on 7.0.26,you will be taken toward the bottom of the same page to aheading with the same version number.Below the version heading,you will see thesubheading“Core”.Below that,immediately above the next subheading,y

13、ou will see threelinks arranged as follows:32-bit/64-bit Windows Service Installer(pgp,md5).(3).Clickon32-bit/64-bitWindowsServiceInstallertodownloadthefile:apache-tomcat-7.0.26.exe(8.2 MB).(4).Before launching the installer file,you have to check its integrity.To do so,you needa small utility to ca

14、lculate its checksum.There are several freely available on the Internet.Idownloaded WinMD5Free from http:/ it worked for me,but thisdoesnt mean I consider it better than any other similar utility.It just h appened to be the firstone I saw.The program doesnt require any special installation:just unzi

15、p it and launch.When you open the Tomcat installer file,you will see a 32-digit hexadecimalnumber verymuch like this:8ad7d25179168e74e3754391cdb24679.(5).Go back to the page from which you downloaded the Tomcat installer and click onthe md5 link(the third one,and second within the parentheses).This

16、will open a page2containing a single line of text,like this:8ad7d25179168e74e3754391cdb24679*apache-tomcat-7.0.26.exeIf the hex string is identical to that calculated by the checksum utility,you know that theversion of Tomcat installer you have downloaded has not been corrupted or modified in anyway

17、.(6).Now that you have verified the correctness of the Tomcat installer,launch it.(7).After youve agreed to the terms of the license,you will then see the dialog shown inFigure 1-5.Click on the plus sign before the Tomcat item and select“Service”and“Native”as shown in the figure before clicking on t

18、he“Next”button.(8).I chose to install Tomcat in the directory“C:Program FilesApache SoftwareFoundationTomcat”instead of the default“Tomcat 7.0”.This is because sometimes youmight like to point to this directory(normally referred to as%CATALINA_HOME%)fromwithin a program,and one day you might replace

19、 Tomcat 7.0 with Tomcat 8.0.By callingTomcats home directory“Tomcat”you are“safe”for years to come.You can also decide toleave the default.In general,by using the defaults,you are likely to encounter fewer problems,because the default settings of any applications are always tested best!(9).Next,the

20、Tomcat installer will ask you to specify the connector port and UserID pluspassword for the administrator login.Leave the port set to 8080,because all the examples inthis book refer to port 8080.If you want,you can always change it later to the HTTP standardport(which is 80).As UserID/Password,you m

21、ight as well use your Windows user name andpassword.It is not critical.(10).Lastly,you will need to provide the path of a Java Runtime Environment.This is thepath you saw when installing Java(see previous section).With the version of Java I installed,the correct path is C:Program FilesJavajre7.3.Wha

22、t is JSPJSP is a technology that lets you add dynamic content to web pages.In absence of JSP,toupdate the appearance or the content of plain static HTML pages,you always have to do it byhand.Even if all you want to do is change a date or a picture,you must edit the HTML fileand type in your modifica

23、tions.Nobody is going to do it for you,whereas with JSP,you canmake the content dependent on many factors,including the time of the day,the informationprovided by the user,the users history of interaction with your web site,and even the usersbrowser type.This capability is essential to provide onlin

24、e services in which you can tailoreach response to the viewer who made the request,depending on the viewers preferences andrequirements.A crucial aspect of providing meaningful online services is for the system to be3able to remember data associated with the service and its users.Thats why databases

25、 play anessential role in dynamic web pages.But lets take it one step at a time.Sun Microsystems introduced JSP in 1999.Developers quickly realized that additionaltags would be useful,and the JSP Standard Tag Library(JSTL)was born.JSTL is a collectionof custom tag libraries that encapsulates the fun

26、ctionality of many JSP standard applications,thereby eliminating repetitions and making the applications more compact.Together withJSTL also came the JSP Expression Language(EL).In 2003,with the introduction of JSP 2.0,EL was incorporated into the JSP specification,making it available for custom com

27、ponents and template text,not just for JSTL,as was thecase in the previous versions.Additionally,JSP 2.0 made it possible to create custom tag files,thereby perfecting the extendibility of the language.In parallel to the evolution of JSP,several frameworks to develop web applicationsbecame available

28、.In 2004,one of them,JavaServer Faces(JSF),focused on building userinterfaces(UIs)and used JSP by default as the underlying scripting language.It provided anAPI,JSP custom tag libraries,and an expression language.The Java Community Process(JCP),formed in 1998,released in May 2006 the JavaSpecificati

29、on Request(JSR)245 titled Java Server Pages 2.1,which effectively aligned JSPand JSF technologies.In particular,JSP 2.1 included a Unified EL(UEL)that merged the twoversions of EL defined in JSP 2.0 and JSF 1.2(itself specified as JSR 252).Sun Microsystemsincludes JSP 2.1 in its Java Platform,Enterp

30、rise Edition 5(Java EE 5),finalized in May 2006as JSR 244.The latest version of Java is 7(specified in JSR 342 and released in July 2011).Itincludes JSP 2.2,Servlets 3.1(JSR 340),EL 3.0(JSR 341),and JSF 2.2(JSR 344).Version 8is expected in mid-2013.At the time of this writing,Java 7 is only availabl

31、e as part of the JSE(Java Standard Edition)platform.The latest version of Java released in the JEE(JavaEnterprise Edition)platform is 6(update 32).JSP ElementsA JSP page is made out of a page template,which consists of HTML code and JSPelements such as scripting elements,directive elements,and actio

32、n elements.In the previouschapter,after explaining how to install Java and Tomcat,I introduced you to JSP andexplained JSPs role within web applications.In this chapter,Ill describe in detail the firsttwo types of JSP elements.IntroductionScripting elements consist of code delimited by particular se

33、quences of characters.The4scriptlets,which you encountered in the examples in Chapter 1 and delimited by the pair,are one of the three possible types of scripting elements.The other two aredeclarations and expressions.All scripting elements are Java fragments capable of manipulating Java objects,inv

34、okingtheir methods and catching Java exceptions.They can send data to the output,and theyexecute when the page is requested.Inthehello.jspexampleofChapter1(Listing1-4),yousawthatrequest.getHeader(user-agent)returns a string that describes the clients web browser,despite the fact that the variable re

35、quest wasnt defined anywhere.It worked beca use Tomcatdefines several implicit objects:application,config,exception,out,pageContext,request,response,and session.Directive elements are messages to the JSP container(i.e.,Tomcat).Their purpose is toprovide information on the page itself necessary for i

36、ts translation.As they have no associationwith each individual request,directive elements do not output any text to the HTML response.The first line of the hello.jsp example was a directive:Besides page,the other directives available in JSP pages are include and taglib.Action elements specify activi

37、ties that,like the scripting elements,need to be performedwhen the page is requested,because their purpose isprecisely to encapsulate activities thatTomcat performs when handling an HTTP request from a client.Action elements can use,modify,and/or create objects,and they may affect the way data is se

38、nt to the output.There aremore than a dozen standard actions:attribute,body,element,fallback,forward,getProperty,include,param,params,plugin,setProperty,text,and useBean.For example,thefollowingaction element includes ina JSP page the outputof another page:In addition to the standard action elements

39、,JSP also provides a mechanism that lets youdefine custom actions,in which a prefix of your choice replaces the prefix jsp of the standardactions.The tag extension mechanism lets you create libraries of custom actions,which youcan then use in all your applications.Several custom actions became so po

40、pular within theprogramming community that Sun Microsystems(now Oracle)decided to standardize them.The result is JSTL,the JSP Standard Tag Library.The Expression Language(EL)is an additional JSP component that provides easy accessto external objects(i.e.,Java beans).EL was introduced in JSP 2.0 as a

41、n alternative to thescripting elements,but you can also use EL and scripting elements together.I will describe EL5in Chapter 4,after explaining the action elements.In the next sections,I will first go through the scripting elements,because they are easierto understand and you can use them to glue to

42、gether the rest.Then,I will describe the implicitobjects and the directives.To help you find the correct examples in the software package forthis chapter,I divided them in folders named according to the section title and thefunctionality tested(e.g.,request object authentication).6介绍介绍 JSPJSP、JAJAV

43、VA A、TomcatTomcat作者:Gary H.Sockut,Balakrishna R.Iyer来源:Beginning JSP,JSF and Tomcat介绍 JSP 和 Tomcat互动性使网络变得真的很有用。通过与远程服务器进行交互,您可以找到您需要的信息,与你的朋友保持联系,或者网上购买东西。每次你输入到一个 web 表单,应用“非常态”的解释你的请求和准备一个 web 页面回应。1.安装 JAVAJavaServer Pages(JSP)技术,帮助您把创建的动态页面脚本文件转换为可执行Java 模块;JavaServer Faces(JSF)是一个包,帮助使用者与创建的页面

44、进行互动;Tomcat 是一个应用程序,该应用程序可以执行你的代码和充当 web 服务器的动态页面。所有你需要开发 JSP/JSF web 应用程序可以从因特网上免费下载,但安装所有必需的包和工具和获取一个集成开发环境,您需要进行护理。没有比处理不正确安装的软件更让人讨厌的事了。当某个程序不能运行,问题经常是很难找到的。在本章中,我将向您介绍 Java servlet 和 JSP 中,我将向您展示如何运用 Tomcat 生成动态网页。但是,首先,我将指导您完成安装的 Java 和 Tomcat:在你的电脑上不会有不能执行的源代码。你必须安装更多的包作为你的进程。做这些正确安装,你将永远不需要再

45、怀疑你自己。总的来说,您将需要至少300MB 的磁盘空间安装 Java 和 Tomcat.同时还需要 600MB的空间安装 Eclipse 开发环境。运行这本书中包含的所有的示例。我用的电脑规格是 2.6GHz AMD Athlon 64 x2(现在不算好的了)1 GB 内存,运行 Windows Vista SP2。在执行任何安装之前,我重新格式化硬盘,安装操作系统从最初的 DVD。我不建议一会儿你做同样的事情!我这么做是为了两种截然相反但是同样重要的原因:首先,我不希望现有的东西来干扰 web 开发所需的最新软件包;第二,我不想依赖任何已安装的程序。我想要给你你需要的完整列表。2.安装 T

46、omcat这是 Java web 服务器,它是 servlet 容器,允许您运行 JSP。如果您已经安装了一个老版本的 Tomcat,你应该在安装新版本之前删掉它。Tomcat 听从你电脑中的三个通信端口(8005、8009 和 8005)。在 Tomcat 安装之前,您应该检查是否已安装好的应用程序听的一个或多个这些端口。打开 DOS 窗口并输入命令 netstat/a。它将以表格的形式显示活动连接的列表。表格的第二行入下:7本地地址0.0.0.0:1350.0.0.0:4450.0.0.0:3306端口号是冒号后面的数字。如果你看到一个或多个端口 Tomcat 使用,安装 Tomcat之后

47、,你将不得不改变它听的端口号。这里是如何正确安装 Tomcat7:(1)、进入网页 http:/tomcat.apache.org/download-70.cgi.在下面第二行,你会看到四个链接:KEYS,7.0.26,Browse,and Archives.(2)、点击 7.0.26,你将被带到与按键版本号相同的下载页面中。您将看到的副标题“核心”。下面,上面马上下一个副标题,您将看到三个链接安排如下:32 位/64 位Windows 服务安装程序(pgp,md5)。(3)、点击下载 32 位/64 位 Windows apache-tomcat-7.0.26 exe(8.2 MB)文件。(

48、4)、在启动安装程序文件之前,您必须检查其完整性。要做到这一点,你需要一个小工具来计算其校验和。在互联网上有很多免费的。我从 http:/ Tomcat 安装程序文件,你会看到一个 32 位十六进制数如下:8ad7d25179168e74e3754391cdb24679.(5)、回到你的页面下载 Tomcat 安装程序,点击 md5 链接(第三个,第二个括号内)。这将打开一个页面包含一行文本,如下:8ad7d25179168e74e3754391cdb24679*apache-tomcat-7.0.26.exe如果十六进制字符串是相同的计算校验和工具,你知道Tomcat安装程序下载的版本并没有

49、以任何方式损坏或修改。(6)、现在您已经正确下载了 Tomcat 安装程序,启动它。(7)、在你同意许可条款,您将看到如图 1-5 所示的对话框。点击加号在 Tomcat项目并选择“服务”和“本地”所示图之前,单击“Next”按钮。(8)、我选择 Tomcat 安装目录中的“C:Program Files Apache SoftwareFoundation Tomcat”而不是默认的 Tomcat 7.0。这是因为有时你可能喜欢指向该目录(通常称为%卡特琳娜家%)从内部程序,有一天你会用 Tomcat 8.0 取代 Tomcat 7.0。通过调用 Tomcat 的主目录“Tomcat”你“安全

50、”。你也可以决定离开默认。一般来说,通过使用默认值,您可能会遇到更少的问题,因为任何应用程序的默认设置总是最好测试!(9)、接下来,Tomcat 安装程序将要求您指定连接器端口和对管理员的用户 id 和密码登录。离开端口设置为 8080,因为所有的例子在这本书中是指端口 8080。如果你愿意,你可以随时改变后来标准 HTTP 端口(80)。作为用户 id/密码,你不妨使用你的 Windows8用户名和密码。这不是关键。(10)、最后,您将需要提供的 Java 运行时环境。这是你看到的路径安装 Java 时(参见上一节)。我安装的 Java 版本的,正确的路径是 C:ProgramFilesJa

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

当前位置:首页 > 研究报告 > 其他报告

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com