欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    计算机专业文献翻译JSP 概览.docx

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

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

    计算机专业文献翻译JSP 概览.docx

    1、计算机专业文献翻译JSP 概览JSP OverviewJSP is the latest Java technology for web application development and is based on the servlet technology introduced in the previous chapter. While servlets are great in many ways, they are generally reserved for programmers. In this chapter, we look at the problems that JS

    2、P technology solves, the anatomy of a JSP page, the relationship between servlets and JSP, and how the server processes a JSP page.In any web application, a program on the server processes requests and generates responses. In a simple one-page application, such as an online bulletin board, you dont

    3、need to be overly concerned about the design of this piece of code; all logic can be lumped together in a single program. However, when the application grows into something bigger (spanning multiple pages, using external resources such as databases, with more options and support for more types of cl

    4、ients), its a different story. The way your site is designed is critical to how well it can be adapted to new requirements and continue to evolve. The good news is that JSP technology can be used as an important part in all kinds of web applications, from the simplest to the most complex.Therefore,

    5、this chapter also introduces the primary concepts in the design model recommended for web applications and the different roles played by JSP and other Java technologies in this model.The Problem with ServletsIn many Java servlet-based applications, processing the request and generating the response

    6、are both handled by a single servlet class. Example 3-1 shows how a servlet class often looks.Example 3-1. A typical servlet classpublic class OrderServlet extends HttpServlet public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException response.se

    7、tContentType(text/html); PrintWriter out = response.getWriter( ); if (isOrderInfoValid(request) saveOrderInfo(request); out.println(); out.println( ); out.println( Order Confirmation); out.println( ); out.println( ); out.println( Order Confirmation); renderOrderInfo(request); out.println( ); out.pri

    8、ntln(); .If youre not a programmer, dont worry about all the details in this code. The point is that the servlet contains request processing and business logic (implemented by methods such as isOrderInfoValid() and saveOrderInfo( ), and also generates the response HTML code, embedded directly in the

    9、 servlet code using println( ) calls. A more structured servlet application isolates different pieces of the processing in various reusable utility classes and may also use a separate class library for generating the actual HTML elements in the response. Even so, the pure servlet-based approach stil

    10、l has a few problems:Thorough Java programming knowledge is needed to develop and maintain all aspects of the application, since the processing code and the HTML elements are lumped together.Changing the look and feel of the application, or adding support for a new type of client (such as a WML clie

    11、nt), requires the servlet code to be updated and recompiled.Its hard to take advantage of web page development tools when designing the application interface. If such tools are used to develop the web page layout, the generated HTML must then be manually embedded into the servlet code, a process whi

    12、ch is time consuming, error prone, and extremely boring.Adding JSP to the puzzle lets you solve these problems by separating the request processing and business logic code from the presentation, as illustrated in Figure 3-1. Instead of embedding HTML in the code, place all static HTML in a JSP page,

    13、 just as in a regular web page, and add a few JSP elements to generate the dynamic parts of the page. The request processing can remain the domain of the servlet, and the business logic can be handled by JavaBeans and EJB components.Figure 3-1. Separation of request processing, business logic, and p

    14、resentationAs I mentioned before, separating the request processing and business logic frompresentation makes it possible to divide the development tasks among people with different skills. Java programmers implement the request processing and business logic pieces, web page authors implement the us

    15、er interface, and both groups can use best-of-breed development tools for the task at hand. The result is a much more productive development process. It also makes it possible to change different aspects of the application independently, such as changing the business rules without touching the user

    16、interface.This model has clear benefits even for a web page author without programming skills, working alone. A page author can develop web applications with many dynamic features, using the JSP standard actions and the JSTL libraries, as well as Java components provided by open source projects and

    17、commercial companies.JSP ProcessingJust as a web server needs a servlet container to provide an interface to servlets, the server needs a JSP container to process JSP pages. The JSP container is responsible for intercepting requests for JSP pages. To process all JSP elements in the page, the contain

    18、er first turns the JSP page into a servlet (known as the JSP page implementation class). The conversion is pretty straightforward; all template text is converted to println( ) statements similar to the ones in the handcoded servlet shown in Example 3-1, and all JSP elements are converted to Java cod

    19、e that implements the corresponding dynamic behavior. The container then compiles the servlet class.Converting the JSP page to a servlet and compiling the servlet form the translation phase. The JSP container initiates the translation phase for a page automatically when it receives the first request

    20、 for the page. Since the translation phase takes a bit of time, the first user to request a JSP page notices a slight delay. The translation phase can also be initiated explicitly; this is referred to as precompilation of a JSP page. Precompiling a JSP page is a way to avoid hitting the first user w

    21、ith this delay. It is discussed in more detail in Chapter 17.The JSP container is also responsible for invoking the JSP page implementation class (the generated servlet) to process each request and generate the response. This is called the request processing phase. The two phases are illustrated in

    22、Figure 3-3.Figure 3-2. JSP page translation and processing phasesAs long as the JSP page remains unchanged, any subsequent request goes straight to the request processing phase (i.e., the container simply executes the class file). When the JSP page is modified, it goes through the translation phase

    23、again before entering the request processing phase.The JSP container is often implemented as a servlet configured to handle all requests for JSP pages. In fact, these two containersa servlet container and a JSP containerare often combined in one package under the name web container.So in a way, a JS

    24、P page is really just another way to write a servlet without having to be a Java programming wiz. Except for the translation phase, a JSP page is handled exactly like a regular servlet; its loaded once and called repeatedly, until the server is shut down. By virtue of being an automatically generate

    25、d servlet, a JSP page inherits all the advantages of a servlet described in Chapter 2: platform and vendor independence, integration, efficiency, scalability, robustness, and security.3.3.1 JSP ElementsThere are three types of JSP elements you can use: directive, action, and scripting. A new constru

    26、ct added in JSP 2.0 is an Expression Language (EL) expression; lets call this a forth element type, even though its a bit different than the other three.3.3.1.1 Directive elementsThe directive elements, shown in Table 3-1, specify information about the page itself that remains the same between reque

    27、stsfor example, if session tracking is required or not, buffering requirements, and the name of a page that should be used to report errors, if any.ElementDescriptionDefines page-dependent attributes, such as session tracking, error page, and buffering requirementsIncludes a file during the translat

    28、ion phaseDeclares a tag library, containing custom actions, that is used in the pageTable 3-1. Directive elements3.3.1.2JavaBeans componentsJSP elements, such as action and scripting elements, are often used to work with JavaBeans components. Put succinctly, a JavaBeans component is a Java class tha

    29、t complies with certain coding conventions. JavaBeans components are typically used as containers for information that describes application entities, such as a customer or an order.JSP Application Design with MVCJSP technology can play a part in everything from the simplest web application, such as

    30、 an online phone list or an employee vacation planner, to complex enterprise applications, such as a human resource application or a sophisticated online shopping site. How large a part JSP plays MVC was first described by Xerox in a number of papers published in the late 1980s. The key differs in e

    31、ach case, of course. In this section, I introduce a design model called Model-View-Controller (MVC), suitable for logic into three distinct units: the Model, the View, and the Controller. In a server application, we commonly classify the parts of the application as business logic, presentation, and

    32、request processing. Business logic is the term used for the manipulation of an applications data, such as customer, product, and order information. Presentation refers to how the application data is displayed to the user, for example, position, font, and size. And finally, request processing is what ties the business logic and presentation parts together. In MVC terms, the Model corresponds to business logic and d


    注意事项

    本文(计算机专业文献翻译JSP 概览.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

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




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开