收藏 分享(赏)

JSP技术 ---外文文献.doc

上传人:精品资料 文档编号:10373638 上传时间:2019-11-04 格式:DOC 页数:9 大小:34.39KB
下载 相关 举报
JSP技术 ---外文文献.doc_第1页
第1页 / 共9页
JSP技术 ---外文文献.doc_第2页
第2页 / 共9页
JSP技术 ---外文文献.doc_第3页
第3页 / 共9页
JSP技术 ---外文文献.doc_第4页
第4页 / 共9页
JSP技术 ---外文文献.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

1、苏州大学文正学院本科生毕业设计(论文)外文文献JSP Technology and ServletsJSP profileJSP (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 H

2、TML 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 that can run on Linux, is also available for other operating systems.JSP technology to use the Java progr

3、amming 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-ba

4、sed 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 pr

5、ogramming operation of the database can be reoriented 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.

6、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.JS script langu

7、age synopsis JS is javascrip, Javascript is one kind the script language which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal language, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmation to th

8、e data, because the network speed was quite slow, only then 28.8kbps, the co苏州大学文正学院本科生毕业设计(论文)nfirmation step wastes time were too many. Therefore Netscape browser Navigator has joined Javascript, has provided the data confirmation basic function. The JavaScript official name is “ECMAScript”. This

9、standard by ECMA organization development and maintenance. ECMA262 is the official JavaScript standard. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape(Navigator 2.0) Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in th

10、e Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has accepted its firstedition. The script uses one specific descriptive language, rests on certain form compilation to be possible the execution document, is also called as great or the batch run docum

11、ent. The script usually may transfer temporarily by the application procedure and carry out. Each kind of script present widely is applied in the homepage design, because the script not only may reduce the homepage the scale and raises the homepage browsing speed, moreover may enrich the homepage pe

12、rformance, like animation, sound and so on. Cites a most common example, when we click in the homepage the Email address can transfer Outlook Express or the Foxmail this kind ofmail software automatically, is realizes through the script function. Also because of script these characteristics, the hum

13、an who harbors ulterior motives by some are often using. For example joins some destruction computer systems order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the system to come under the attack. Therefore the user should

14、 act according to visits homepage the trust degree selective security rank, specially regarding these itself content on the illegal homepage, do not permit the use script easily. Through “the safe establishment” the dialog box, the choice “the script” under option each kind of establishment may with

15、 ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most important technology which use Java technology to exploit request of server, and it is also the standard which exploit business application .Java developers prefer to use it for a vari

16、ety of reasons, one苏州大学文正学院本科生毕业设计(论文)of which is already familiar with the Java language for the development of this technology are easy to learn Java to the other is “a preparation, run everywhere“ to bring the concept of Web applications, To achieve a “one-prepared everywhere realized.“ And more

17、importantly, if followed some of the principles of good design, it can be said of separating and content to create high-quality, reusable, easy to maintain and modify the application. For example, if the document in HTML embedded Java code too much (script), will lead the developed application is ex

18、tremely complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, can logic is not very clear, a large number of HTML and Java code mixed

19、 together. This is the random development of the defects.Early dynamic pages mainly CGI (Common Gateway Interface, public Gateway Interface) technology, you can use different languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powe

20、rful, because of difficulties in programming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all the newtechnology, JSP / Servlet with more efficient and easy to program, more powerful,more secure and has a good portability, they have been many peopl

21、e believe that the future is the most dynamic site of the future development of technology.Similar to CGI, Servlet support request / response model. When a customer submit a request to the server, the server presented the request Servlet, Servlet responsible for handling requests and generate a resp

22、onse, and then gave the server, and then from the server sent to the customer. And the CGI is different, Servlet not generate a new process, but with HTTP Server at the same process. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: W

23、hen received from the clients request, calling service methods, the method of Servlet arrival of the first judgement is what type of request (GET / POST / HEAD), then calls the appropriate treatment (DoGet / doPost / doHead) and generate a response.Although such a complex, in fact, simply said to Se

24、rvlet is a Java class. And the general category of the difference is that this type operating in a Servlet container, which can provide session management and targeted lifecycle management. So 苏州大学文正学院本科生毕业设计(论文)that when you use the Servlet, you can get all the benefits of the Java platform, includ

25、ing the safety of the management, use JDBC access the database and crossplatform capability. Moreover, Servlet using thread, and can develop more efficient Webapplications.JSP technology is a key J2EE technology, it at a higher level of abstraction of a Servlet. It allows conventional static and dyn

26、amic HTML content generated by combining an HTML page looks like, but as a Servlet to run. There are many commercial application server support JSP technology, such as BEA WebLogic, IBM WebSphere, JRun, and so on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, and a

27、 JSP document, you can put it Fangdao any static HTML files can be placed, do not have to compile, do not have to pack, do not have to ClassPath settings, you can visit as ordinary Web It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HT

28、ML document, but inside contains a number of Java code. It uses. Jsp the suffix, used to tell the server this document in need of special treatment. When we visit a JSP page, the document will first be translated into a JSP engine Java source files, is actually a Servlet, and compiler, and then, lik

29、e other Servlet, from Servlet engine to handle. Servlet engine of this type loading, handling requests from customers, and the results returned to the customer.After another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded directly call the

30、 Servlet. If you have already been modified, it will be once again the implementation of the above process, translate, compile and load. In fact, this is the so-called “first person to punishment.“ Because when the first visit to the implementation of a series of the above process, so will spend som

31、e time after such a visit would not.Java servlets offer a powerful API that provides access to all the information about the request, the session, and the application. combining JSP with servlets lets you clearly separate the application logic from the presentation of the application; in other words

32、, it lets you use the most appropriate component type for the roles of Model, View and Controller. 苏州大学文正学院本科生毕业设计(论文)Servlets, Filters, and ListenersA servlet is a Java class that extends a server with functionality for processinga request and producing a response. Its implemented using the classes

33、 and interfaces defined by the Servlet API. The API consists of two packages: the javax.servlet package contains classes and interfaces that are protocolindependent, while the javax.servlet.http package provides HTTP-specific extensions and utility classes.What makes a servlet a servlet is that the

34、class implements an interface namedjavax.servlet.Servlet, either directly or by extending one of the support classes. This interface defines the methods used by the web container to manage and interact with the servlet. A servlet for processing HTTP requests typically extends the javax.servlet.http.

35、HttpServlet class. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlets lifecycle. It creates an instance of the servlet class when needed, passes requests to the instance for p

36、rocessing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropriate times in the servlet lifecycle. Besides the doGet( ) and doPost( ) methods, there are methods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( )

37、, doPut( ), and doTrace( ). Typically you dont implement these methods; the HttpServlet class already takes care of HEAD, OPTIONS, and TRACE requests in a way thats suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a web application. Its important to realize that the

38、 container creates only one instance of each servlet. This means that the servlet must be thread safe -able to handle multiple requests at the same time, each executing as a separate thread through the servlet code. Without getting lost in details, you satisfy this requirement with regards to instan

39、ce variables if you modify the referenced objects only in the init( ) and destroy( ) methods, and just read them in the request processing methods.Compiling and Installing a Servlet苏州大学文正学院本科生毕业设计(论文)To compile a servlet, you must first ensure that you have the JAR file containing all Servlet API cl

40、asses in the CLASSPATH environment variable. The JAR file is distributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib directory. On a Windows platform, you include the JARfile in the CLASSPATH. Reading a Request One of the arguments passed to th

41、e doGet( ) and doPost( ) methods is an object that implements the HttpServletRequest interface. This interface defines methods that provide access to a wealth of information about the request. Generating a ResponseBesides the request object, the container passes an object that implements the HttpSer

42、vletResponse interface as an argument to the doGet( ) and doPost( ) methods. This interface defines methods for getting a writer or stream for the response body.It also defines methods for setting the response status code and headers. Using Filters and Listeners The servlet specification defines two

43、 component types beside servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if youre using a container that doesnt yet support this version of the specification, Im afraid youre out of luck.FiltersA filter is a component that can intercept a request

44、targeted for a servlet, JSP page, or static page, as well as the response before its sent to the client. This makes it easy to centralize tasks that apply to all requests, such as access control, logging, and charging for the content or the services offered by the application. A filter has full acce

45、ss to the body and headers of the request and response, so it can also perform various transformations. One example is compressing the response body if the Acceptlanguage request header indicates that the client can handle a compressed response. 苏州大学文正学院本科生毕业设计(论文)A filter can be applied to either a

46、 specific servlet or to all requests matching a URL pattern, such as URLs starting with the same path elements or having the same extension.ListenersListeners allow your application to react to certain events. Prior to Servlet 2.3,you could handle only session attribute binding events (triggered whe

47、n an object was added or removed from a session). You could do this by letting the object saved as a sessionattributimplement the HttpSessionBindingListener interface. With the new interfaces introduced in the 2.3 version of the specification, you can create listeners for servlet context and session

48、 lifecycle events as well as session activation and passivation events (used by a container that temporarily saves session state to disk or migrates a session to another server). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in on

49、e place, instead of placing individual listener objects in each session.The new types of listeners follow the standard Java event model. In other words, a listener is a class that implements one or more of the listener interfaces. The interfaces define methods that correspond to events. The listener class is registered with the container when the application starts, and the container then calls the event methods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized before they can be used. For instance, they may n

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报