视频监控维保服务系统的开发外文翻译资料

 2023-01-29 15:56:26

英语原文共 5 页,剩余内容已隐藏,支付完成后下载完整资料


毕业设计(论文)

外文资料翻译

说明:

封面之后放英文原文;英文原文之后放译文。

原文:

Web application developers traditionally have used JSP technology to build HTML dynamically by including Java code in the HTML source. But did you know that you can use this same approach to generate dynamic content besides HTML? You can, and its relatively simple. You can build a JSP page using an XML document that will serve as the template for the output, then replace the portions that must be generated dynamically based on the underlying business logic. You use Java code, either written directly within the JSP page or called externally from the page, to generate the dynamic portions of the document.

You are in control of how much of that document is generated. For example, you can use Java code to generate data between XML tags, to generate portions of the XML document tree (both tags and data), or even to generate the entire document.

The Java code is removed from the page, processed into a servlet (known as the page servlet) and run by the Java application server as part of the request for the JSP page. The result is pure XML.

A JSP technology overview

Lets begin by talking a little about how JSP pages work. Were going to keep it simple and focus on some of the basics. For more information, see Resources for links to additional JSP technology information.

In the traditional sense, JSP pages look very much like HTML pages, with a few extra tags. These tags allow the designer to embed Java code (not JavaScript) in the page itself. A Web application server, like the IBM WebSphere Application Server, will intercept requests for JSP pages. Its tipped off to their existence by the pages extension: .jsp (not .html). The Web application server then preprocesses the JSP page, taking out the JSP tags and any embedded Java code, leaving only the HTML. The extracted JSP tags and embedded Java code are used to build a Java servlet (JSP page servlet) that runs the code and inserts the results back into the original page where the JSP tags used to be. The result is pure HTML. The Java is stripped out and run on the server before the requesting browser sees any result.

We can apply the same principle to an XML page. Before the requester of the JSP page containing XML ever sees the XML (be it a browser or some other B2B application), the Java code is stripped out of the JSP page and used to generate additional content, which is inserted back into the page at the points where the JSP tags used to reside. This feature gives you the ability to control exactly where new content is to be inserted, down to the character.

Well look at how to make this work in a minute. First, lets consider why you might want to create dynamic XML using JSP. Why not simply write a Java application or servlet to generate the entire document? Why bother with JSP at all? The most important reason, providing only portions of an XML document are dynamic, is that it makes sense not to regenerate that static content for every request. Using a JSP page, the static XML within the page acts as a template that is filled out by the dynamic content. Your Java code is tasked with generating only the content that might change over time -- a more efficient approach.

As a practical matter, JSP pages allow you to separate tasks for which different developers will be responsible. In particular, they allow you to better separate the data from the view, allowing you to add new presentations without affecting the logic. Imagine having one Java servlet that performs the business logic and redirects the resulting data to an appropriate JSP page based on the nature of the request. For example, a servlet might redirect data to a JSP page containing WML when it detects a WAP phone browser making the request. It could also redirect the data to a JSP page containing HTML for standard browser requests.

The mechanics

Lets walk through an example in which a static XML document is converted to a JSP page, and portions of its content are rewritten to be dynamically generated. The example is based on an XML sample shipped as part of the IBM WebSphere Transcoding Publisher called FlightInfo. This XML document represents information about a specific airline flight itinerary. Transcoding Publisher provides it as a sample to show how the product can be used to render the XML data in device-appropriate formats. But before Transcoding Publisher, or any other application, has a chance to manipulate the document, we want to build some of its content dynamically.

Rename the file using a .jsp extension

First, we need to rename the file with a .jsp extension so that the Web server will know what to do with the file. Web servers have rules for acting on certain URL patterns or file extensions, such as .html or .gif. When a Web application server is added to a Web server, the application server adds rules to the Web servers list for handling URLs and file extensions specific to the application server. When a Web server sees a file with a .jsp extension, it will pass that request on to the Web application server for processing.

Add the page directive

Next, we need to indicate to the JSP page compiler what the format of the generated content will be. By default, the page compiler will assume the content is HTML. To override this, a JSP page directive tag must be added to set the content type. For JSP 1.0, the content type page directive looks like this.

Its important to note that the JSP page compiler will remove only the characters making up the tag and its contents. If you place a JSP tag on a new line, the

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


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

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

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