欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    关于JAVA技术毕业论文外文翻译.doc

    • 资源ID:29904958       资源大小:153.79KB        全文页数:25页
    • 资源格式: DOC        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    关于JAVA技术毕业论文外文翻译.doc

    附录一 外文资料原文:ABOUT JAVA TECHNOLOGYServlets and JSP: An Overview1. What are Java Servlets?Servlets are Java technology's answer to CGI programming. They are programs that run on a Web server and build Web pages. Building Web pages on the fly is useful (and commonly done) for a number of reasons: · The Web page is based on data submitted by the user. For example the results pages from search engines are generated this way, and programs that process orders for e-commerce sites do this as well. · The data changes frequently. For example, a weather-report or news headlines page might build the page dynamically, perhaps returning a previously built page if it is still up to date. · The Web page uses information from corporate databases or other such sources. For example, you would use this for making a Web page at an on-line store that lists current prices and number of items in stock. 2. What are the Advantage of Servlets Over "Traditional" CGI?Java servlets are more efficient, easier to use, more powerful, more portable, and cheaper than traditional CGI and than many alternative CGI-like technologies. (More importantly, servlet developers get paid more than Perl programmers :-). · Efficient. With traditional CGI, a new process is started for each HTTP request. If the CGI program does a relatively fast operation, the overhead of starting the process can dominate the execution time. With servlets, the Java Virtual Machine stays up, and each request is handled by a lightweight Java thread, not a heavyweight operating system process. Similarly, in traditional CGI, if there are N simultaneous request to the same CGI program, then the code for the CGI program is loaded into memory N times. With servlets, however, there are N threads but only a single copy of the servlet class. Servlets also have more alternatives than do regular CGI programs for optimizations such as caching previous computations, keeping database connections open, and the like. · Convenient. Hey, you already know Java. Why learn Perl too? Besides the convenience of being able to use a familiar language, 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 utilities. · Powerful. Java servlets let you easily do several things that are difficult or impossible with regular CGI. For one thing, servlets can talk directly to the Web server (regular CGI programs can't). This simplifies operations that need to look up images and other data stored in standard places. Servlets can also share data among each other, making useful things like database connection pools easy to implement. They can also maintain information from request to request, simplifying things like session tracking and caching of previous computations. · Portable. Servlets are written in Java and follow a well-standardized API. Consequently, servlets written for, say I-Planet Enterprise Server can run virtually unchanged on Apache, Microsoft IIS, or WebStar. Servlets are supported directly or via a plugin on almost every major Web server. · Inexpensive. There are a number of free or very inexpensive Web servers available that are good for "personal" use or low-volume Web sites. However, with the major exception of Apache, which is free, most commercial-quality Web servers are relatively expensive. Nevertheless, once you have a Web server, no matter the cost of that server, adding servlet support to it (if it doesn't come preconfigured to support servlets) is generally free or cheap. 3. What is JSP?Java Server Pages (JSP) is a technology that lets you mix regular, static HTML with dynamically-generated HTML. Many Web pages that are built by CGI programs are mostly static, with the dynamic part limited to a few small locations. But most CGI variations, including servlets, make you generate the entire page via your program, even though most of it is always the same. JSP lets you create the two parts separately. Here's an example: <!DOCTYPE HTML PUBLIC "-/W3C/DTD HTML 4.0 Transitional/EN"><HTML><HEAD><TITLE>Welcome to Our Store</TITLE></HEAD><BODY><H1>Welcome to Our Store</H1><SMALL>Welcome,<!- User name is "New User" for first-time visitors -> <% out.println(Utils.getUserNameFromCookie(request); %>To access your account settings, click<A HREF="Account-Settings.html">here.</A></SMALL><P>Regular HTML for all the rest of the on-line store's Web page.</BODY></HTML>4. What are the Advantages of JSP?· vs. Active Server Pages (ASP). ASP is a similar technology from Microsoft. The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS-specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers. · vs. Pure Servlets. JSP doesn't give you anything that you couldn't in principle do with a servlet. But it is more convenient to write (and to modify!) regular HTML than to have a zillion println statements that generate the HTML. Plus, by separating the look from the content you can put different people on different tasks: your Web page design experts can build the HTML, leaving places for your servlet programmers to insert the dynamic content. · vs. Server-Side Includes (SSI). SSI is a widely-supported technology for including externally-defined pieces into a static Web page. JSP is better because it lets you use servlets instead of a separate program to generate that dynamic part. Besides, SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like. · vs. JavaScript. JavaScript can generate HTML dynamically on the client. This is a useful capability, but only handles situations where the dynamic information is based on the client's environment. With the exception of cookies, HTTP and form submission data is not available to JavaScript. And, since it runs on the client, JavaScript can't access server-side resources like databases, catalogs, pricing information, and the like. · vs. Static HTML. Regular HTML, of course, cannot contain dynamic information. JSP is so easy and convenient that it is quite feasible to augment HTML pages that only benefit marginally by the insertion of small amounts of dynamic data. Previously, the cost of using dynamic data would preclude its use in all but the most valuable instances. OverviewJavaServer Pages (JSP) lets you separate the dynamic part of your pages from the static HTML. You simply write the regular HTML in the normal manner, using whatever Web-page-building tools you normally use. You then enclose the code for the dynamic parts in special tags, most of which start with "<%" and end with "%>". For example, here is a section of a JSP page that results in something like "Thanks for ordering Core Web Programming"for URL of http:/host/OrderConfirmation.jsp?title=Core+Web+Programming: Thanks for ordering a<I><%= request.getParameter("title") %></I>You normally give your file a .jsp extension, and typically install it in any place you could place a normal Web page. Although what you write often looks more like a regular HTML file than a servlet, behind the scenes, the JSP page just gets converted to a normal servlet, with the static HTML simply being printed to the output stream associated with the servlet's service method. This is normally done the first time the page is requested, and developers can simply request the page themselves when first installing it if they want to be sure that the first real user doesn't get a momentary delay when the JSP page is translated to a servlet and the servlet is compiled and loaded. Note also that many Web servers let you define aliases that so that a URL that appears to reference an HTML file really points to a servlet or JSP page. Aside from the regular HTML, there are three main types of JSP constructs that you embed in a page: scripting elements, directives, and actions. Scripting elements let you specify Java code that will become part of the resultant servlet, directives let you control the overall structure of the servlet, and actions let you specify existing components that should be used, and otherwise control the behavior of the JSP engine. To simplify the scripting elements, you have access to a number of predefined variables such as request in the snippet above. Note that this tutorial covers version 1.0 of the JSP specification. JSP has changed dramatically since version 0.92, and although these changes were almost entirely for the better, you should note that version 1.0 JSP pages are almost totally incompatible with the earlier JSP engines. 2. Syntax SummaryJSP Element Syntax Interpretation Notes JSP Expression <%= expression %>Expression is evaluated and placed in output. XML equivalent is<jsp:expression>expression</jsp:expression>. Predefined variables are request, response, out, session, application, config, and pageContext (available in scriptlets also). JSP Scriptlet <% code %>Code is inserted in service method. XML equivalent is<jsp:scriptlet>code</jsp:scriptlet>. JSP Declaration <%! code %>Code is inserted in body of servlet class, outside of service method. XML equivalent is<jsp:declaration>code</jsp:declaration>. JSP page Directive <% page att="val" %>Directions to the servlet engine about general setup. XML equivalent is<jsp:directive.page att="val">. Legal attributes, with default values in bold, are: · import="package.class" · contentType="MIME-Type" · isThreadSafe="true|false" · session="true|false" · buffer="sizekb|none" · autoflush="true|false" · extends="package.class" · info="message" · errorPage="url" · isErrorPage="true|false" · language="java" JSP include Directive <% include file="url" %>A file on the local system to be included when the JSP page is translated into a servlet. XML equivalent is<jsp:directive.include  file="url">.The URL must be a relative one. Use the jsp:include action to include a file at request time instead of translation time. JSP Comment <%- comment -%>Comment; ignored when JSP page is translated into servlet. If you want a comment in the resultant HTML, use regular HTML comment syntax of <- comment ->. The jsp:include Action <jsp:include page="relative URL" flush="true"/>Includes a file at the time the page is requested. If you want to include the file at the time the page is translated, use the page directive with the include attribute instead. Warning: on some servers, the included file must be an HTML file or JSP file, as determined by the server (usually based on the file extension). The jsp:useBean Action <jsp:useBean att=val*/> or<jsp:useBean att=val*>.</jsp:useBean> Find or build a Java Bean. Possible attributes are: · id="name" · scope="page|request|session|application" · class="package.class" · type="package.class" · beanName="package.class" The jsp:setProperty Action <jsp:setProperty att=val*/>Set bean properties, either explicitly or by designating that value comes from a request parameter. Legal attributes are · name="beanName" · property="propertyName|*" · param="parameterName" · value="val" The jsp:getProperty Action <jsp:getProperty name="propertyName" value="val"/>Retrieve and output bean properties.   The jsp:forward Action <jsp:forward page="relative URL"/>Forwards request to another page.   The jsp:plugin Action <jsp:plugin attribute="value"*> .</jsp:plugin>Generates OBJECT or EMBED tags, as appropriate to the browser type, asking that an applet be run using the Java Plugin.   3. Template Text: Static HTMLIn many cases, a large percent of your JSP page just consists of static HTML, known as template text. In all respects except one, this HTML looks just like normal HTML, follows all the same syntax rules, and is simply "passed through" to the client by the servlet created to handle the page. Not only does the HTML look normal, it can be created by whatever tools you already are using for building Web pages. For example, I used Allaire's HomeSite for most of the JSP pages in this tutorial. The one minor exception to the "template text is passed straight through" rule is that, if you want to have "<%" in the output, you need to put "<%" in the template text. 4. JSP Scripting ElementsJSP scripting elements let you insert Java code into the servlet that will be generated from the current JSP page. There are three forms: 1. Expressions of the form <%= expression %> that are evaluated and inserted into the output, 2. Scriptlets of the form <% code %> that are inserted into the servlet's service method, and 3. Declarations of the form <%! code %> that are inserted into the body of the servlet class, outside of any existing methods. Each of these is described in more detail below. 4.1 JSP ExpressionsA JSP expression is used to insert Java values directly into the output. It has the following form: <%= Java Expression %>The Java expression is evaluated, converted to a string, and inserted in the page. This evaluation is performed at run-time (when the page is requested), and thus has full access to information about the request. For example, the following shows the date/time that the page was requested: Current time: <%= new java.util.Date() %>To simplify these expressions, there are a number of predefined variables that you can use. These implicit objects are discussed in more detail later, but for the purpose of expressions, the most important ones are: · request, the HttpServletRequest; · response, the HttpServletResponse; · session, the HttpSession associated with the request (if any); and · out, the PrintWriter (a buffered version of type JspWriter) used to send output to the client. Here's an example: Your hostname: <%= request.getRemoteHost() %>Finally, note that XML authors can use an alternative syntax for JSP expressions: <jsp:expression>Java Expression</jsp:expression>Remember that XML elements, unlike HTML ones, are case sensitive. So be sure to use lowercase. 4.2 JSP ScriptletsIf you want to do something more complex than insert a simple expression, JSP scriptlets let you insert arbitrary code into the servlet method that will be built to generate the page. Scriptlets have the following form: <% Java Code %>Scriptlets have access to the same automatically defined variables as expressions. So, for example, if you want output to appear in the resultant page, you would use the out variable. <% String queryData = request.getQueryString();out.println("Attached GET data: " + queryData); %>Note that code inside a scriptlet gets inserted exactly as written,

    注意事项

    本文(关于JAVA技术毕业论文外文翻译.doc)为本站会员(豆****)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

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

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开