JSP介绍

JSP介绍
JSP介绍

JSP简介

一、JSP介绍

JSP全名为Java Server Pages,中文名叫java服务器页面,其根本是一个简化的Servlet设计。JSP是SUN公司推出的,是J2EE(Java 2 Enterprise Edition,Java2企业版)十三种核心技术中最重要的一种。JSP是基Java 语言的一种Web应用开发技术,利用这一技术可以建立安全、跨平台的先进动态网站。如今,许多著名的Web网站都使用了JSP技术。

二、JSP技术概述

JSP技术有点类似ASP技术,它是在传统的网页HTML文件中插入Java程序段和JSP 标记,从而形成JSP文件,后缀名为(*.jsp)。用JSP开发的Web应用是跨平台的,既能在Linux下运行,也能在其他操作系统上运行。它实现了Html语法中的java扩展(以<%, %>形式)。JSP与Servlet一样,是在服务器端执行的。通常返回给客户端的就是一个HTML文本,因此客户端只要有浏览器就能浏览。

JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。JSP 将网页逻辑与网页设计的显示分离,支持可重用的基于组件的设计,使基于Web的应用程序的开发变得迅速和容易。 JSP是一种动态页面技术,它的主要目的是将表示逻辑从Servlet中分离出来。

Java Servlet是JSP的技术基础,而且大型的Web应用程序的开发需要Java Servlet 和JSP配合才能完成。JSP具备了Java技术的简单易用,完全的面向对象,具有平台无关性且安全可靠,主要面向因特网的所有特点。

作为一种基于文本的、以显示为中心的开发技术,JSP以Java Servlet为基础,提供了Java Servlet的所有优点,并且当与一个JavaBeans类结合在一起时,提供了一种使内容和显示逻辑分开的简单方式。分开内容和显示逻辑使得更新页面外观的人员不必懂得Java代码,而更新JavaBeans类的人员也不必是设计网页的行家里手,就可以用带有JavaBeans类的JSP页面来定义Web模板,以建立一个由具有相似的外观的页面组成的网站。

三、JSP语言特点

1.优点

(1)一次编写,到处运行。除了系统之外,代码不用做任何更改。系统的多平台支持。基本上可以在所有平台上的任意环境中开发,在任意环境中进行系统部署,在任意环境中扩展。相比ASP的局限性JSP的优势是显而易见的。

(2)强大的可伸缩性。从只有一个小的Jar文件就可以运行Servlet/JSP,到由多台服务器进行集群和负载均衡,到多台Application进行事务处理,消息处理,一台服务器到无数台服务器,Java显示了一个巨大的生命力。

(3)多样化和功能强大的开发工具支持。这一点与ASP很像,Java已经有了许多非常优秀的开发工具,而且许多可以免费得到,并且其中许多已经可以顺利的运行于多种平台之下。

(4)支持服务器端组件。web应用需要强大的服务器端组件来支持,开发人员需要利用其他工具设计实现复杂功能的组件供web页面调用,以增强系统性能。JSP可以使用成熟的JAVA BEANS 组件来实现复杂商务功能。

2.缺点

(1)与ASP也一样,Java的一些优势正是它致命的问题所在。正是由于为了跨平台的功能,为了极度的伸缩能力,所以极大的增加了产品的复杂性。

(2) Java的运行速度是用class常驻内存来完成的,所以它在一些情况下所使用的内存比起用户数量来说确实是“最低性能价格比”了。

四、JSP的应用模型

利用JSP技术,动态信息由JSP页面来表现,JSP页面由安装在Web服务器或者使用JSP的应用服务器上的JSP引擎执行。JSP引擎接受客户端对JSP页面的请求,并且生成JSP页面作为对客户端的响应。

JSP页面通常被编译成为Java Servlets,这是一个标准的Java扩展。页面开发人员能够访问全部的Java应用环境,以利用Java技术的扩展性和可移植性。当JSP页面第一次被调用时,如果它还不存在,就会被编译成为一个Java Servlets类,并且存储在服务器的内存中。这就使得在接下来的对该页面的调用中,服务器会有非常快的响应(这避免了CGI-BIN为每个HTTP请求生成一个新的进程的问题)。

JSP页面可以包含在多种不同的应用体系结构或者模型中,可以用于由不同协议、组件和格式所组成的联合体中。基于JSP的动态信息发布技术是一个开放的、可扩展的建立动态Web页面的标准。不论采用什么创建工具,开发人员都可以使用JSP页面来创建可移植的Web应用,在不同的Web应用服务器上运行。

此外,通过开发标识库,JSP技术可以进一步扩展。第三方开发人员和其他人员可以为常用功能创建自己的标识库。这使得Web页面开发人员能够使用熟悉的工具和如同标识一样的执行特定功能的构件来进行工作。JSP技术很容易整合到多种应用体系结构中,以利用现存的工具和技巧,并且能扩展到支持企业级的分布式应用中。

JSP技术简介及特点——外文翻译

JSP Technology Conspectus And Specialties By:Kathy Sierra and Bert Bates Source: Servlet&JSP The JSP (Java Server mix) technology is used by the Sun microsystem issued by the company to develop dynamic Web application technology. With its easy, cross-platform, in many dynamic Web application programming languages, in a short span of a few years, has formed a complete set of standards, and widely used in electronic commerce, etc. In China, the JSP now also got more extensive attention, get a good development, more and more dynamic website to JSP technology. The related technologies of JSP are briefly introduced. The JSP a simple technology can quickly and with the method of generating Web pages. Use the JSP technology Web page can be easily display dynamic content. The JSP technology are designed to make the construction based on Web applications easier and efficient, and these applications and various Web server, application server, the browser and development tools work together. The JSP technology isn't the only dynamic web technology, also not the first one, in the JSP technology existed before the emergence of several excellent dynamic web technology, such as CGI, ASP, etc. With the introduction of these technologies under dynamic web technology, the development and the JSP. Technical JSP the development background and development history In web brief history, from a world wide web that most of the network information static on stock transactions evolution to acquisition of an operation and infrastructure. In a variety of applications, may be used for based on Web client, look no restrictions. Based on the browser client applications than traditional based on client/server applications has several advantages. These benefits include almost no limit client access and extremely simplified application deployment and management (to update an application, management personnel only need to change the program on a server, not thousands of installation in client applications). So, the software industry is rapidly to build on the client browser multi-layer application. The rapid growth of exquisite based Web application requirements development of technical improvements. Static HTML to show relatively static content is right choice, The new challenge is to create the interaction based on Web applications, in these procedures, the

JSP技术简介(外文翻译)

JSP技术概述 一、JSP的好处 二、JSP页面最终会转换成servler。因而,从根本上,JSP页面能够执 行的任何任务都可以用servler来完成。然而,这种底层的等同性并不意味着servler和JSP页面对于所有的情况都等同适用。问题不在于技术的能力,而是二者在便利性、生产率和可维护性上的不同。毕竟,在特定平台上能够用Java编程语言完成的事情,同样可以用汇编语言来完成,但是选择哪种语言依旧十分重要。 和单独使用servler相比,JSP提供下述好处: 三、λJSP中HTML的编写与维护更为简单。JSP中可以使用常规的HTML: 没有额外的反斜杠,没有额外的双引号,也没有暗含的Java语法。 四、λ能够使用标准的网站开发工具。即使对那些对JSP一无所知的 HTML工具,我们也可以使用,因为它们会忽略JSP标签(JSP tags)。 五、λ可以对开发团队进行划分。Java程序员可以致力于动态代码。Web 开发人员可以将经理集中在表示层(presentation layer)上。对于大型的项目,这种划分极为重要。依据开发团队的大小,及项目的复杂程度,可以对静态HTML和动态内容进行弱分离(weaker separation)和强分离(stronger separation)。 六、在此,这个讨论并不是让您停止使用servlets,只使用JSP。几乎 所有的项目都会同时用到这两种技术。针对项目中的某些请求,您可能会在MVC构架下组合使用这两项技术。我们总是希望用适当的工具完成相对应的工作,仅仅是servlet并不能填满您的工具箱。 二、JSP相对于竞争技术的优势 许多年前,Marty受到邀请,参加一个有关软件技术的小型(20个人)研讨会.做在Marty旁边的人是James Gosling--- Java编程语言的发明者。 隔几个位置,是来自华盛顿一家大型软件公司的高级经理。在讨论过程中,研讨会的主席提出了Jini的议题,这在当时是一项新的Java技术.主席向该经理询问他的想法.他继续说,他们会持续关注这项技术,如果这

JSP简介

JSP(JavaServer Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。JSP技术有点类似ASP技术,它是在传统的网页HTML文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件(*.jsp)。 用JSP开发的Web应用是跨平台的,即能在Linux下运行,也能在其他操作系统上运行。 JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。JSP将网页逻辑与网页设计和显示分离,支持可重用的基于组件的设计,使基于Web的应用程序的开发变得迅速和容易。 Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序段,然后将执行结果连同JSP文件中的HTML代码一起返回给客户。插入的Java程序段可以操作数据库、重新定向网页等,以实现建立动态网页所需要的功能。 JSP与Java Servlet一样,是在服务器端执行的,通常返回该客户端的就是一个HTML文本,因此客户端只要有浏览器就能浏览。 JSP的1.0规范的最后版本是1999年9月推出的,12月又推出了1.1规范。目前较新的是JSP1.2规范,JSP2.0规范的征求意见稿也已出台。

JSP页面由HTML代码和嵌入其中的Java代码所组成。服务器在页面被客户端请求以后对这些Java代码进行处理,然后将生成的HTML页面返回给客户端的浏览器。Java Servlet 是JSP的技术基础,而且大型的Web应用程序的开发需要Java Servlet和JSP配合才能完成。JSP具备了Java技术的简单易用,完全的面向对象,具有平台无关性且安全可靠,主要面向因特网的所有特点。 1.JSP技术的强势 (1)一次编写,到处运行。在这一点上Java比PHP更出色,除了系统之外,代码不用做任何更改。 (2)系统的多平台支持。基本上可以在所有平台上的任意环境中开发,在任意环境中进行系统部署,在任意环境中扩展。相比ASP/PHP的局限性是现而易见的。 (3)强大的可伸缩性。从只有一个小的Jar文件就可以运行Servlet/JSP,到由多台服务器进行集群和负载均衡,到多台Application进行事务处理,消息处理,一台服务器到无数台服务器,Java显示了一个巨大的生命力。 (4)多样化和功能强大的开发工具支持。这一点与ASP很像,Java已经有了许多非常优秀的开发工具,而且许多可以免费得到,并且其中许多已经可以顺利

JSP初级入门教程--JSP概述

jsp(iava server pages)是由sun 公司在java语言上开发出来的一种动态网页制作技术,其可使您可以将网页中的动态部分和静态的html相分离。您可以使用平常得心应手的工具并按照平常的方式来书写html语句。然后,将动态部分用特殊的标记嵌入即可,这些标记常常以“<%”开始并以“%>”结束。例如,这儿有一个jsp页面: <html> <head><title>jsp教程</title></head> <body> <i><%out.println(“hello world”);%></i> </body></html> 它将输出“hello world”。 通常,您要将文件以“.jsp”为扩展名,并将它放置到任何您可以放置普通web 页面的路径下。尽管jsp文件看起来更象是html文件而不是servlet文件,但,事实上,它恰恰将转换为servlet文件,其中的静态html仅仅用来输出servlet服务方法返回的信息。如果jsp pages 已经被转换为servlet且servlet 被编译进而被装载(在第一次被request时),当您再次request 此jsp页面时,将察觉不到一瞬的延迟。也请留意这个现象,一些web servers允许您为它定义别名,从而,好象一个url是指向一个html,但事实上它指向的是一个servlet 或jsp pages. 构造一个jsp page,除了可内嵌的规则的html,还有三类主要的jsp元素:scrīpting elements,directives,和actions.使用scrīpting elements您可以定义最终转换为servlet的部分,directives 使您可以控制这个servlet的整体结构,而actions 使您可以指定可重用的已有组件,另外,还可控制jsp引擎的运行。为了简化scrīpting elements,您可以在某一段上利用一些预定义的变量,如request。 本教程式是以jsp1.1版本进行讲解的。其语法概括如下表,其详细使用在随后的课程中详细讲解.

JSP技术英文简介

Introduction of JSP Technology JavaServer PagesTM (jsp (SUN enterprise application of choice)) technology for the creation of display content dynamically generated Web page provides a simple and rapid method. jsp (SUN enterprise application of choice) technology is designed to enable structure-based Web applications more easily and faster, and can these applications with a variety of Web servers, application servers, browsers, and development tools to work together. Here provides a jsp (SUN enterprise application of choice) technology overview, describes the background of its development, as well as the overall objective of this technology. At the same time, a simple example, also describes a JavaTM technology-based key component of the page. Web application development of JavaServer Pages technology Ways In the development of jsp (SUN enterprise application of choice) specification process, Sun Microsystems (Sun Microsystems Inc.) And many major Web servers, application servers and development tools providers, as well as a variety of experienced development groups to cooperate. The result is found a page for applications and developers to balance the portability and ease of use of development methodologies. Will generate and display the contents of the separation Using jsp technology, Web page developers can use HTML or xml logo to design and formatting the final page. Jsp logo or the use of bound feet would have to generate dynamic content on the page. The logic-generated content has been packaged in a logo and JavaBeans components and tied up in a small script, all the scripts in the server-side run. If the core logic was encapsulated in the logo and Beans, then other people, such as management and Web page designers, can edit and use jsp pages, without affecting the generation of content. The server side, jsp engine explained jsp logo and small script to generate the requested content (for example, by accessing JavaBeans components, the use of technology JDBCTM access the database, or include file), and the results to HTML (or xml) page of the form sent back to the browser. This helps the author to protect their code, and ensure that any HTML-based Web browser completely availability. Emphasis on reusable components Jsp page relies on the vast majority of reusable, cross-platform components (JavaBeans or Enterprise JavaBeansTM components) to implement the requirements of applications more complex treatment. Developers to be able to share and exchange components to perform common operations, or make these components more user or client groups to use. Component-based approach to accelerate the overall development process, and make a variety of organizations in their existing skills and to optimize the results of development efforts in the balance. Used to simplify page development logo Web page developers are not familiar with the scripting language of the programmer. JavaServer Page technology packages a number of functions, which are in use with the jsp-related xml logo in dynamic content generation needs. Jsp logo standards can access and instantiate JavaBeans components, set or retrieve components of property, download Applet, and implementation by other means more difficult to encode and time-consuming function. Through the development of customized logos library, jsp technology can be extended. In future, third-party developers and other personnel for commonly used features to create your own

jsp介绍外文翻译

外文原文 JSP JSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML web page document (*. htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*. jsp). Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems. JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy. Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function. JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit. JSP 1.0 specification of the final version is launched in September 1999, December has introduced 1.1 specifications. At present relatively new is JSP1.2 norms, JSP2.0 norms of the draft has also been introduced. JSP pages from HTML code and Java code embedded in one of the components. The server was in the pages of client requests after the Java code and then will generate the HTML pages to return to the client browser. Java Servlet JSP is the technical foundation and large-scale Web application development needs of Java Servlet and JSP support to complete. JSP with the Java technology easy to use, fully object-oriented, and a platform-independent and secure, mainly for all the characteristics of the Internet. JavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web

JSP介绍

JSP简介 一、JSP介绍 JSP全名为Java Server Pages,中文名叫java服务器页面,其根本是一个简化的Servlet设计。JSP是SUN公司推出的,是J2EE(Java 2 Enterprise Edition,Java2企业版)十三种核心技术中最重要的一种。JSP是基Java 语言的一种Web应用开发技术,利用这一技术可以建立安全、跨平台的先进动态网站。如今,许多著名的Web网站都使用了JSP技术。 二、JSP技术概述 JSP技术有点类似ASP技术,它是在传统的网页HTML文件中插入Java程序段和JSP 标记,从而形成JSP文件,后缀名为(*.jsp)。用JSP开发的Web应用是跨平台的,既能在Linux下运行,也能在其他操作系统上运行。它实现了Html语法中的java扩展(以<%, %>形式)。JSP与Servlet一样,是在服务器端执行的。通常返回给客户端的就是一个HTML文本,因此客户端只要有浏览器就能浏览。 JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。JSP 将网页逻辑与网页设计的显示分离,支持可重用的基于组件的设计,使基于Web的应用程序的开发变得迅速和容易。 JSP是一种动态页面技术,它的主要目的是将表示逻辑从Servlet中分离出来。 Java Servlet是JSP的技术基础,而且大型的Web应用程序的开发需要Java Servlet 和JSP配合才能完成。JSP具备了Java技术的简单易用,完全的面向对象,具有平台无关性且安全可靠,主要面向因特网的所有特点。 作为一种基于文本的、以显示为中心的开发技术,JSP以Java Servlet为基础,提供了Java Servlet的所有优点,并且当与一个JavaBeans类结合在一起时,提供了一种使内容和显示逻辑分开的简单方式。分开内容和显示逻辑使得更新页面外观的人员不必懂得Java代码,而更新JavaBeans类的人员也不必是设计网页的行家里手,就可以用带有JavaBeans类的JSP页面来定义Web模板,以建立一个由具有相似的外观的页面组成的网站。 三、JSP语言特点 1.优点 (1)一次编写,到处运行。除了系统之外,代码不用做任何更改。系统的多平台支持。基本上可以在所有平台上的任意环境中开发,在任意环境中进行系统部署,在任意环境中扩展。相比ASP的局限性JSP的优势是显而易见的。

【计算机专业文献翻译】JSP概述

JSP介绍 J2EE(Java2企业版)已经承担起了曾经很混乱的建立互联网平台的任务,并使开发者们能够使用Java来高效地创建多层服务器端应用程序。现今,Java企业版的API已经扩展为涵盖了众多领域:用于远程对象处理的RMI和CORBA,用于数据库交互的JDBC,用于访问命名和目录服务的JNDI,用于创建可重用商务组件的企业级JavaBeans(EJB),用于面向消息的中间件的JMS TM(Java Messaging Service,Java消息服务),用于XML处理的JAXP TM,以及用于执行原子性(atomic)事务的JTA TM(Java Transaction API,Java事务API)。另外,J2EE还支持servlets是一种非常流行的用于替代CGI脚本的Java小程序。这些技术的组合使得程序员可以为各种不同的任务创建分布式的商务解决方案。 在1999年末,Sun Microsystems公司向企业级Java工具集中加入了一个新的元素:Java Server Pages(JSP,Java服务器页面)。JSP建立在Java servlet之上,它的设计目的是使程序员乃至非程序员都能高效地创建Web内容。 什么是JSP? 简明扼要地说,JSP是一种用来开发含有动态内容网页的技术。纯HTML页面只包含静态的内容,它的内容通常保持不变,而JSP页面则不同,它可以根据任意数量的变量来改变自己的内容,这些变量包括用户的身份信息,用户使用的浏览器类型,用户提供的信息,以及用户所做的选择等。 JSP页面就和常规的网页一样,包含标准的标记语言元素,例如HTML的标签。然而,JSP页面还包含特殊的JSP元素,这些元素使得服务器可以把动态内容插入到网页中。JSP 元素的用途非常广泛,例如从数据库取得信息,或记录用户的个性信息。当用户请求一个JSP页面时,服务器先执行JSP元素,并把结果同网页的静态部分相结合,然后把动态合成后的页面送回到浏览器。 JSP定义了许多用于Web应用程序的有用的标准元素,例如访问JavaBeans组件的元素,在页面间传递控制权的元素,以及在请求,页面和用户间共享信息的元素。程序员也可以通过使用应用程序的专用元素来扩展JSP语法,从而完成像访问数据库和EJB,发送电子邮件,生成表示应用程序专用数据的HTML这样的任务,与JSP规范相关的规范(JSTL规范)定义了一组这种常用的自定义元素。标准元素和自定义元素的组合确保了可以开发出强大的Web 应用程序。 为什么要使用JSP? 在Web发展的早期,CGI(Common Gateway Interface,公共网关接口)是开发动态Web 内容的唯一工具,然而,CGI并非一种高效率的解决方案。对每一个传来的请求,Web服务器都必须创建一个新的操作系统进程,载入一个解释器和一个脚本,接着执行这个脚本,然后再把这些全部释放掉。这使得服务器承受着繁重的负担,而且当通信量增加时性能会变得很低。 过去几年里,出现了许多CGI的替代品和增强版,例如FastCGI,Apache的mod_perl,Netscape的NSAPI,Microsoft的ISPAI和Sun Microsystems的Java servlet。虽然这些解决方案能提供更高的性能和可缩放性,但是所有这些技术都面临着同一个问题:它们都是通过把HTML代码直接嵌入到程序语言代码中来生成网页。这使得动态网页的创建成为程序员所独立的领域。然而,JSP改变了这一切。 在HTML页面中嵌入动态元素

Servlet和JSP技术简介中英文资料外文翻译文献

Servlet和JSP 中英文资料外文翻译文献 An Overview of Servlet and JSP Technology Marty Hall and Larry Brown,2000-07, Core Servlets and JavaServer Pages chapter 1 1.1A Servlet's Job Servlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 1-1. Figure 1-1 1.Read the explicit data sent by the client. The end user normally enters this data in an HTML form on a Web page. However, the data could also come from an applet or a custom HTTP client program. 2.Read the implicit HTTP request data sent by the browser. Figure 1-1 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and compression schemes the browser understands,

JSP DOM介绍

JSP DOM介绍 DOM是Document Object Model的缩写,即文档对象模型,是W3C组件推荐的处理XML的标准接口,定义了所有文档元素的对象和属性,以及访问它们的方法(接口)。W3C文档对象模型(DOM)定义了访问诸如XML和XHTML文档的标准,是一个使程序和脚本有能力动态地访问和更新文档的内容、结构以及样式的平台和语言中立的接口。 W3C DOM被分为3个不同的部分: ●核心DOM 用于任何结构化文档的标准模型。 ●XML DOM 用于XML文档的标准模型。 ●HTML DOM 用于HTML文档的标准模型。 XML DOM定义了访问和处理XML文档的标准方法。XML DOM是XML D ocument Object Model的缩写,即XML文档对象模型,是用于获取、更改、添加或删除XML元素的标准。HTML DOM定义所有HTML元素的对象和属性,以及访问它们的方法(接口)。 W3C文件对象模型(DOM)可以看作是一个平台或语言中立的(language-neu tral)界面,它允许程序和脚本动态的访问以及更新文档的内容、结构、脚本程序。在这里DOM仅仅只是一种对某种功能和结构的声明,告诉别的对象,具有什么样的概念定义。简单来看,DOM可以看作是一组API(Application Program Interface 即应用程序接口),它把HTML文档,XML文档等看成一个文档对象,在里面存放的是对这些文档操作的属性和方法的定义。DOM技术并不是首先用于XML文档,对于HTML文档来说,早就可以使用DOM来读取里面的数据了。 W3C DOM提供了一组描述HTML及XML文件的标准对象和一个用来访问和操作这类文件的标准界面。若以面向对象的思维来看,可以把HTML文档或XML 文档看成是一个对象,一个XML文档对象可以包含其它的对象,如节点对象。对XML文档对象的操作实际是对该对象的节点对象的操作,可以对对象进行修改等操作。在DOM中有相应的对象对应实际的XML文档的对象,那么也可以这样理解DOM,在DOM规范中提供了一组对象对文档结构的访问。 DOM独立于程序设计语言,W3C组织以IDL(Interface Definition Language,接口定义语言)的形式定义了DOM中的接口。某种程序语言要实现DOM,需要将DOM接口转换为本语言中的适当结构,为了保证不同语言的不同的DOM之间实现广泛的兼容,W3C组织在DOM规范的附录部分提供了Java和ECMAScript两种语言的绑定。在特定语言中使用DOM规范就需要定义DOM规范指定的接口,并给出实现这些接口的类的集合,这一过程称作语言绑定。本章讲述DOM规范的Java 语言绑定。Java语言通过把DOM规范中的接口用Java的接口写下来,并给出实现这些接口的类集合来实现DOM规范的Java语言绑定。当然了,我们还可以使用C

JSP概述

JSP (Java Server Pages )是由Sun 公司以Java 语言为脚本语言开发出来的一种动态网页制作技术,主要完成网页中服务器动态部分的编写。该技术是在Servlet 技术的基础上形成的,并继承了Java 语言的多种优势,如安全性、支持多线程、平台无关性等。与其他动态网页技术相比较,如ASP 、PHP 等,具有运行速度快、安全等特点。 本章将简要介绍JSP 的产生到现状,并重点介绍构建JSP 的运行平台,即Tomcat 和JDK 的 安装及配置。在本章最后给出一个JSP+JavaBean+Servlet 实例,演示JSP 各部分的运行情况。 了解Web 技术的产生和发展。 了解JSP 的产生和应用。 了解JSP 的技术优势。 掌握常见JSP 的设计模式。 掌握JDK 下载、安装、配置。 掌握Tomcat 下载、安装。 掌握编写JSP 工作原理。 了解JSP 页面包含元素。 了解JSP 的开发流程。 1.1 JSP 简介 要熟练掌握JSP 技术,首先需要了解JSP 的产生和发展历史,明确JSP 技术在Web 技术中所占有位置,JSP 技术能够解决的问题。在本小节中,将主要介绍JSP 形成的必然原因,与其他动态技术相比所具有的优势。 1.1.1 JSP 技术概述 在Internet 发展的最初阶段,HTML 语言只能在浏览器中展现静态的文本或图像信息,这无

成了JSP网页(*.jsp)。Web服务器在收到访问JSP网页的请求时,首先执行其中的程序片段,然后将执行结果以HTML格式返回给客户。程序片段可以操作数据库、重新定向网页、发送E-mail 等等,这就是建立动态网站所需要的功能。JSP所有程序操作都在服务器端执行,网络上传送给客户端仅是得到的结果,对客户浏览器的要求最低。 Servlet是JSP技术的发展前身,它是Java技术对CGI编程的回应。Servlet程序在服务器端运行,动态生成Web页面。Servlet由Java语言编写,运行在Tomcat服务器中,能够主动生成HTML标记和客户端需要的数据,并能够将生成的数据返回到客户端。与传统的CGI和许多其他类似CGI的技术相比,Java Servlet具有更高的效率,更容易使用,功能更强大,具有更好的可移植性,更节省投资。其详细信息如表1-1所示。 表1-1Servlet技术优势 高效在传统的CGI中,每个请求都要启动一个新的进程,如果CGI程序本身的执行时间较短,启动进程所需要的开销很可能反而超过实际执行时间。而在Servlet中,每个请求由一个轻量级的Java 线程处理(而不是重量级的操作系统进程); 在传统CGI中,如果有N个并发的对同一CGI程序的请求,则该CGI程序的代码在内存中重 复装载了N次;而对于Servlet,处理请求的是N个线程,只需要一份Servlet类代码。在性能 优化方面,Servlet也比CGI有着更多的选择,比如缓冲以前的计算结果,保持数据库连接的活 动等 方便Servlet提供了大量的实用工具例程,例如自动地解析和解码HTML表单数据、读取和设置HTTP 头、处理Cookie、跟踪会话状态等 功能强大在Servlet中,可以完成许多使用传统CGI程序很难完成的任务。例如,Servlet能够直接和Web 服务器交互,而普通的CGI程序不能。Servlet还能够在各个程序之间共享数据,很容易实现数 据库连接池之类的功能 可移植性好Servlet用Java语言编写,Servlet API具有完善的标准。因此,为I-Planet Enterprise Server写的Servlet无需任何实质上的改动即可移植到Apache、Microsoft IIS或者WebStar。所有主流服务 器都直接或间接通过插件支持Servlet 节省投资不仅有许多廉价甚至免费的Web服务器可供个人或小规模网站使用,而且对于现有的服务器,如果它不支持Servlet的话,要加上这部分功能也往往是免费的(或只需要极少的投资) 但遗憾的是,Servlet具有一个致命缺点,就是所有响应代码都是通过Servlet程序生成的,如HTML标记。一个Servlet程序,其中大量的代码都是用来生成这些HTML标记响应代码,只有其中少部分代码用作数据的处理和响应。并且开发Servlet程序起点要求较高,Servlet产生之后,没有像PHP和ASP那样,快速得到应用。故Sun公司在结合了Servlet技术和ASP技术等特点,又推出了JSP技术,JSP技术完全继承了Servlet技术的优势,并具备了一些新的优势。JSP相对

外文翻译-----JSP简介

JSP Open Category: WEB, JAVA, dynamic pages, the Knowledge Network Contents ? JSP Profile ? JSP technology strength ? JSP technology vulnerable ? JSP six built-in objects: ? JSP dynamic web site development and technology JSP Profile JSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many companies to participate in the establishment of a dynamic web page technical standards. JSP technology somewhat similar to ASP technology, it is in the traditional HTML web page document (*. htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*. jsp). Using JSP development of the Web application is cross-platform that can run on Linux, is also available for other operating systems. JSP technology to use the Java programming language prepared by the category of XML tags and scriptlets, to produce dynamic pages package processing logic. Page also visit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page design and display separation, support reusable component-based design, Web-based application development is rapid and easy. Web server in the face of visits JSP page request, the first implementation of the procedures of, and then together with the results of the implementation of JSP documents in HTML code with the return to the customer. Insert the Java programming operation of the database can be re-oriented websites, in order to achieve the establishment of dynamic pages needed to function. JSP and Java Servlet, is in the implementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.

相关主题
相关文档
最新文档