JSP 技术外文翻译资料

 2023-08-29 09:08

JSP Technology

JSP (JavaServer Pages) is a kind of based on Java script technology. In many of the advantages of JSP, one of which is it can the HTML code from Web pages in the business logic of the effectively separated. With JSP visit reusable components, such as Servlet, JavaBean and based on Java Web applications. JSP also support in Web page direct embedded Java code. The two methods can visit JSP files: browser to send files request, sent to the JSP Servlet request.

JavaServer Pages technology is an extension of the Java Servlet technology. Servlets are platform-independent, server-side modules that fit seamlessly into a Web server framework and can be used to extend the capabilities of a Web server with minimal overhead, maintenance, and support. Unlike other scripting languages, servlets involve no platform-specific consideration or modifications; they are application components that are downloaded, on demand, to the part of the system that needs them. Together, JSP technology and servlets provide an attractive alternative to other types of dynamic Web scripting/programming by offering: platform independence; enhanced performance; separation of logic from display; ease of administration; extensibility into the enterprise; and, most importantly, ease of use.

The Unified Expression Language (EL)

The simple EL included in JSP 2.0 technology offers many advantages to the page author. Using simple expressions, page authors can easily access external data objects from their pages. The JSP technology container evaluates and resolves these expressions as it encounters them. It then immediately returns a response because the JSP request-processing model has only one phase, the render phase. However, because the request-processing model does not support a postback, all JSP expressions are read-only.

Unlike JSP technology, JavaServer Faces technology supports a multiphase life cycle. When a user enters values into the JavaServer Faces UI components and submits the page, those values are converted, validated, and propagated to server-side data objects, after which component events are processed. In order to perform all these tasks in an orderly fashion, the JavaServer Faces life cycle is split into separate phases. Therefore, JavaServer Faces technology evaluates expressions at different phases of the life cycle rather than immediately, as JSP technology would do.

JSP technology -- friend or foe?

Presentation technology was designed to transform plain ol raw Web content into content wrapped in an attractive presentation layer. JavaServer Pages (JSP) technology, Suns presentation model and part of the J2EE platform, has received significant attention. There are both advantages and disadvantages to using JSP technology, and Web developers should be aware of the good and the bad -- and know that they dont have to be limited to this single technology. In fact, these days a number of presentation technologies are available. This article begins by defining the problems presentation technologies were designed to solve. It then examines the specific strengths and weaknesses of the JSP model. Finally, it introduces some viable alternatives to Suns presentation technology. A bit of historyBefore diving into an explanation of presentation technology, its helpful to fill in some details on the situation that led to the birth of the technology. Just 10 short years ago, the term thin client was a novelty. We still lived in a world of desktop applications, powered by wimpy 286 microprocessors with 14-inch monitors that we squinted at. Boy, have times changed! Now my desktop does nothing but power a Web browser, while servers from Sun, IBM, HP, Compaq, and the rest churn out computations, business logic, and content. And that little monitor? Replaced by flat-screen, plasma, whopping 21- and 25-inch beauties. Why? So we can see the intricate and complex HTML displays that serve as a front-end to these powerful applications. No longer does a clunky interface suffice; now we expect flashy graphics, moving images, color-coordinated presentations that would look good in any room in the house, and speedy rendering to boot.

The premiseToday, a decade beyond those fledgling Windows applications, we are still dealing with this huge shift in the presentation paradigm. The woeful Visual Basic and C programmers who remain now find themselves working either on back-end systems or Windows-only applications, or they have added a Web-capable language such as the Java language to their toolbox. An application that doesnt support at least three of four ML-isms -- such as HTML, XML, and WML -- is considered shabby, if not an outright failure. And, of course, that means we all care very deeply about the ability to easily develop a Web presentation layer.As it turns out, using the new Internet, and all the languages we have at our disposal -- Java, C, Perl, Pascal, and Ada, among others -- hasnt been as easy as we might have hoped. A number of issues creep up when it comes to taking the programming languages everyone used for back-end systems and leveraging them to generate markup language suitable for a client. With the arrival of more options on the browser (DHTML and JavaScript coding, for example), the increase in graphic artist talent in the Web domain, and tools that could create complex interfaces using standard HTML, the demand for fancy user interfaces has grown faster than our ability to develop these front ends to our applications. And this has given rise to presentation technology.Presentation technology was designed to perform a single task: convert content, namely data without display details, into presentation -- meaning the various user interfaces you see on your phone, PalmPilot, or Web browser. What are the problems that these presentation technologies claimed to solve? Lets take a look.

Segregation vs

剩余内容已隐藏,支付完成后下载完整资料


JSP 技术

 JSP(JavaServer Pages)是一种基于Java的脚本技术。在JSP 的众多优点之中,其中之一是它能将 HTML 编码从 Web 页面的业务逻辑中有效地分离出来。用 JSP 访问可重用的组件,如 Servlet、JavaBean 和基于 Java 的 Web 应用程序。JSP 还支持在 Web 页面中直接嵌入 Java 代码。可用两种方法访问 JSP 文件:浏览器发送 JSP 文件请求、发送至 Servlet 的请求。

JavaServer页技术在教育领域的延伸,爪哇Servlet技术。服务器端模块 Servlets也是独立于平台的,那无缝进网页服务器框架,可以用于扩展功能的一个网络服务器用最小的代价、维护和支持。不像其他的脚本语言,servlets涉及没有平台相关的考虑或者修改;他们的应用程序组件,下载,对需求,对系统的一部分,需要他们。在一起,JSP技术和servlets提供一个更有吸引力的选择到其他类型的动态网页脚本/规划在祭:平台独立性;增强的表现;分离的逻辑从显示;易于管理、延伸性进企业;而且,最重要的是,简单易用。

统一的表现语言(EL)

简单的EL包括在JSP 2.0技术也提供了许多优势网页作者。作者用简单的表情,一页就可以很容易地找到外部数据对象从他们的网页。JSP技术评估和解决这些表达式容器作为它碰到他们。然后,它立即返回一个响应因为JSP request-processing模型只有一个阶段,呈现阶段。然而,由于request-processing模型不支持一个回发,所有的JSP表达式是只读的。

不像JSP技术,JavaServer面临的技术支持多相生命周期。当用户输入值到JavaServer UI组件的脸并提交页面,这些价值的转换,确认,并传播到服务器端数据对象,之后组件事件正在处理中。为了完成所有这些任务中有序的时尚,JavaServer面临生命周期是可以分成不同的阶段。因此,JavaServer面临工艺评定表达生命周期的不同阶段,而不是立即,JSP技术都会做的事。

此外,表达式可能会被用于设置以及获得数据,这样的价值观也进入了一个用户界面组件传播给服务器端的对象在回发。最后,一些JavaServer面临技术可被调用方法表达在服务器端的对象的生命周期的不同阶段为了验证数据和处理组件事件。

JSP 技术 -- 是友还是敌?

表示技术设计用来将平淡的拉丁文原始 Web内容转化为包装在有吸引力的表示层中的内容。JavaServer Pages (JSP)技术,作为 Sun 公司的表示模型和 J2EE平台的一部分,受到了极大关注。使用 JSP 技术有利有弊,Web开发人员应知晓这些利弊 --懂得他们不必拘泥于这一技术。实际上,近来出现了许多表示技术。本文以表示技术所要解决的问题为开端,然后考察JSP 模型的特有优势和弱点。最后,介绍几个可以代替 Sun的表示技术的可行方案。历史点滴

在深入解释表示技术之前,介绍一些导致此技术产生的详细背景资料很有帮助。仅仅在10年前, 瘦客户机还是一个很新的术语。那时我们还生活在台式机应用程序的世界中,使用低级的286 微处理器,眯着眼看 14英寸的显示器。但是现在时代不同了,读者们!现在,我的台式机除了运行Web 浏览器之外什么也不干。我们使用 Sun、IBM、HP、Compaq和其他公司的服务器来运行计算、业务逻辑和内容。那个小显示器呢?它已被又大又漂亮的21 英寸和 25英寸等离子体平面显示器所取代。为什么呢?因为这样我们就可以观看错综复杂的HTML 显示,而这些 HTML显示是强大的应用程序的前端。单调沉闷的界面已不能满足要求;现在,我们希望看到华丽的图形、移动的图像、色彩协调的表示,不管哪个房间看上去都那么漂亮,并且能够快速显示出来。

前提

十年后的今天,作为雏形的 Windows应用程序已经成为历史,我们仍面临着表示方法上的巨大转变。悲惨的Visual Basic 和 C 程序员发现,他们现在只能编写后端系统或仅用于Windows 的应用程序,或者已在自己的工具箱中添加了能提供 Web功能的语言,例如 Java 语言。不支持四分之三以上 ML 语言(如HTML、XML 和WML)的应用程序即使不被认为是完全失败的,也会被认为是很低劣的。当然,这说明我们都很注重很容易地开发Web 表示层的能力。 结果是,使用新的因特网,以及我们熟悉的所有语言(Java、C、Perl、Pascal、Ada以及其他语言)都不像我们所希望的那么容易。当将每个人都使用的编程语言用于后端程序并生成适用于客户机的标记语言时,会出现一大量的问题。随着浏览器提供更多的选项(例如DHTML 和 JavaScript 编码)、Web领域图形艺术人才的增加、以及能够使用标准 HTML生成复杂界面的工具的出现,对别具一格的用户界面的需求比我们开发这些应用程序前端的能力增长得还要快。这就导致了 表示技术的兴起。 表示技术设计用来执行一项任务:将内容(即不带显示详细信息的数据)转换为表示-- 即您在电话、掌上电脑或 Web浏览器中看到的各种用户界面。这些表示技术声称能够解决哪些问题?让我们来看一下。

隔离与集成

表示技术的最基本目的是使得内容和表示可以分离开来。换言之,业务逻辑单元(可能用C 或 Java语言编写)不必以表示特定的方式生成代码。数据或者内容以原始形式返回,不带任何格式。之后,表示技术为这些内容添加格式或表示。结果是,数据被图形、格式、颜色和徽标环绕包围起来。 请看清单 1 和清单 2中的示例,看一下原始内容和结合了表示技术的内容之间的区别。清单 1显示的是原始内容,除了数据外别无他物,可以通过多种方式使用。清单 1. 只包含数据的原始内容

class=displaycodeRussell Crowe

Tom Hanks

Meg Ryan

Mary Stuart Masterson

Alec Baldwin

Ashley Judd

Keanu Reeves

清单 2就比上一个清单复杂多了,它显示的是相同的数据,但这些数据包装在表示技术中,并且随时可以在支持HTML 的浏览器中显示。清单 2.用表示包装的数据

class=displaycodelt;HTMLgt;

lt;HEADgt;

lt;TITLEgt;搜索结果:演员lt;/TITLEgt;

lt;/HEADgt;

lt;BODYgt;

lt;H2 ALIGN='center'gt;搜索结果:演员lt;/H2gt;

lt;CENTERgt;

lt;HR WIDTH='85%'gt;

lt;TABLE WIDTH='50%' CELLPADDING='3' CELLSPACING='3' BORDER='1'

BGCOLOR='#FFFFCC'gt;

lt;TR BGCOLOR='#FFCCCC'gt;

lt;TH WIDTH='50%' ALIGN='center'gt;姓lt;/THgt;

lt;TH WIDTH='50%' ALIGN='center'gt;名lt;/THgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Baldwinlt;/TDgt;

lt;TD WIDTH='50%'gt;Aleclt;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Crowelt;/TDgt;

lt;TD WIDTH='50%'gt;Russelllt;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Hankslt;/TDgt;

lt;TD WIDTH='50%'gt;Tomlt;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Juddlt;/TDgt;

lt;TD WIDTH='50%'gt;Ashleylt;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Mastersonlt;/TDgt;

lt;TD WIDTH='50%'gt;Mary Stuartlt;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Reeveslt;/TDgt;

lt;TD WIDTH='50%'gt;Keanult;/TDgt;

lt;/TRgt;

lt;TRgt;

lt;TD WIDTH='50%'gt;Ryanlt;/TDgt;

lt;TD WIDTH='50%'gt;Meglt;/TDgt;

lt;/TRgt;

lt;/TABLEgt;

lt;/CENTERgt;

lt;/BODYgt;

lt;/HTMLgt;

清单 1中的内容对毫无经验的外行人来说,易于理解,也便于使用。清单 2中的内容则专用于在浏览器中显示。从清单 2中提取数据,或处理它用于其他目的,就需要有一些技巧。这一基本区别 --将表示和内容分开而不是集成在一起的处理(至少在用户不需要这些信息时是这样),是表示技术(包括 JSP技术)的前提。进一步说,没有达到这一基本目标的表示技术就没有真正实现设计的最初目的。

编写与修改

除了将内容和表示分离开来以外,衡量表示技术是否有用的另外一个因素则是它所免除的修改工作量。表示和内容的分离加大了内容开发人员的角色差别。程序员可将注意力集中在前面示例中的原始内容上,图形艺术家或网站管理员则可将精力放在表示上。但是,在把艺术家设计的表示或标记取出并加入到程序员编制的内容中时,还会出现一些角色交迭。 在最简单的情况下,艺术家提供标记,开发人员提供代码并将标记插入表示技术中。然后,应用程序“启动”,内容会魔术般地变成一个用户界面。当然,我们都知道,开发工作通常不会仅止于此。下一步是修订和更改界面,并编制新的业务规则,这正是检验表示技术灵活性的地方。虽然更新输入到表示层中的原始数据通常并不难,但是图形艺术家就很难对他们的原始作品进行编辑。对表示层的更改是很常见的(我们都饱受过市场部门改这改那之苦)。所以,现在出现了这样一个问题:设计人员应该从何处入手来更改他们的工作?是修改他们交给开发人员的原始标记语言页吗?可能不是。因为最可能的是,此页很可能已插入定制标记或代码(JSP页、模板引擎)、转化为 Java servlet、或者已变得面目全非了。通常,设计人员必须在原始页上进行修改,并再次把此页交给开发人员。开发人员必须把此页再次转化为表示技术所使用的特定格式。否则,设计人员就必须学会一种脚本语言,或至少懂得此页中的哪些源代码区域是禁止入内的。当然,这是一种容易出错的、非常危险的方法。一旦您确定下来以一种表示技术支持内容和表示之间的明确分离,您就应确保改变表示所需的修改工作量限定在最小。

JSP 技术的承诺

现在,我们来讨论 JSP 编码的具体内容。JSP技术承诺为设计人员和开发人员提供他们所需的最合适的表示技术。JSP技术是 J2EE 平台的一部分,显示了 Sun 公司所能给予 Java产品的最强大支持。为了使您对此解决方案的流行程度有一个概念,您可以试着在amazon.com 上搜索一下“JSP”,您会发现,论述 JSP的书籍比论述其他任何一种 Java API 的书籍都要多。在我深入讨论 JSP技术存在的特定问题之前,您需要对它承诺的功能有一个清楚的了解。

内容与表示

首先,JSP 技术是用来分离内容和表示的,这一点最早出现在 Sun 对于 JSP公布的一系列目标中。实际上,JSP的设计直接针对开发人员的抱怨,这些开发人员对于在 servlet代码中反复键入 out.println('lt;HTMLgt;lt;HEADgt;lt;TITLEgt;' pageInfo.getTitle() 'lt;/TITLEgt;lt;/HEADgt;') 感到厌烦。这种硬编码内容和运行时变量的混合对 servlet开发人员造成了巨大的负担,也使开发人员在对表示层进行即便是最小的改动时也困难重重。 JSP 技术通过支持普通 HTML 页(以及稍后的 WML或其他标记语言页)在运行时编译为 Javaservlet,改变了这种情况。它实际上是模仿 out.println() 语句,

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[609356],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

课题毕业论文、文献综述、任务书、外文翻译、程序设计、图纸设计等资料可联系客服协助查找。