JSP技术---外文文献(最新整理)

上传人:good****022 文档编号:116344136 上传时间:2022-07-05 格式:DOCX 页数:10 大小:112.04KB
收藏 版权申诉 举报 下载
JSP技术---外文文献(最新整理)_第1页
第1页 / 共10页
JSP技术---外文文献(最新整理)_第2页
第2页 / 共10页
JSP技术---外文文献(最新整理)_第3页
第3页 / 共10页
资源描述:

《JSP技术---外文文献(最新整理)》由会员分享,可在线阅读,更多相关《JSP技术---外文文献(最新整理)(10页珍藏版)》请在装配图网上搜索。

1、苏州大学文正学院本科生毕业设计(论文)外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many co mpanies to participate in the establishment of a dynamic web page technical standa rds. JSP technology somewhat similar to ASP technology, it is in the traditional

2、 H TML web page document (*. htm, *. html) to insert the Java programming paragra ph (Scriptlet) and JSP tag (tag), thus JSP documents (*. jsp). Using JSP developme nt of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java

3、programming language prepared by the catego ry 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 lo gic. JSP page logic and web page design and display separation, support reusable c om

4、ponent-based design, Web-based application development is rapid and easy.Web server in the face of visits JSP page request, the first implementation of t he procedures of, and then together with the results of the implementation of JSP d ocuments in HTML code with the return to the customer. Insert

5、the Java programm ing operation of the database can be reoriented websites, in order to achieve the est ablishment of dynamic pages needed to function.JSP and Java Servlet, is in the im plementation of the server, usually returned to the client is an HTML text, as long as the client browser will be

6、able to visit.JSP 1.0 specification of the final version is launched in September 1999, Dece mber 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 an d Java code embedded in one of the components

7、.JS script language synopsisJS 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 con

8、firmatio n to the data, because the network speed was quite slow, only then 28.8kbps, the confirmation step wastes time were too many. Therefore Netscape browser Navigato r has joined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This sta

9、ndard by ECMA orga nization development and maintenance. ECMA262 is the official JavaScript standa rd. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape (Navigator 2.0) Brendan Eich has invented this language, started from 1996, alrea dy appeared in all Netscape and in t

10、he Microsoft browser. The ECMA262 develop ment began in 1996, in 1997 July, the ECMA general meeting has accepted its first edition.The script uses one specific descriptive language, rests on certain form compil ation to be possible the execution document, is also called as great or the batch run do

11、cument. The script usually may transfer temporarily by the application procedur e and carry out. Each kind of script present widely is applied in the homepage desi gn, because the script not only may reduce the homepage the scale and raises the h omepage browsing speed, moreover may enrich the homep

12、age performance, like a nimation, sound and so on. Cites a most common example, when we click in the ho mepage the Email address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because o f script these characteristic

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

14、 user s hould act according to visits homepage the trust degree selective security rank, spe cially 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 scrip t” under option each kind of establi

15、shment may with ease realize to script being for bid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most important technology which us e Javatechnology to exploit request of server, and it is also the standard which explo it business application .Java developers prefer to

16、use it for a variety of reasons, oneof which is already familiar with the Java language for the development of this tec hnology are easy to learn Java to the other is a preparation, run everywhere to bri ng the concept of Web applications, To achieve a one-prepared everywhere realized. And more impo

17、rtantly, if followed some of the prin ciples 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 develope d application is ext

18、remely complex, difficult to read, it is not easy reuse, but also fo r future maintenance and modification will also cause difficulties. In fact, CSDN th e JSP / Servlet forum, can often see some questions, the code is very long, can logi c is not very clear, a large number of HTML and Java code mix

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

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

21、ny people believe that t he future is the most dynamic site of the future development of technology.Similar to CGI, Servlet support request / response model. When a customer su bmit a request to the server, the server presented the request Servlet, Servlet respon sible for handling requests and gene

22、rate a response, and then gave the server, and t hen from the server sent to the customer. And the CGI is different, Servlet not gene rate a new process, but with HTTP Server at the same process. It threads through t he use of technology, reduce the server costs. Servlet handling of the request proc

23、e ss is this: When received from the clients request, calling service methods, the met hod of Servlet arrival of the first judgement is what type of request (GET / POST / HEAD), then calls the appropriate treatment (DoGet / doPost / doHead) and g enerate a response.Although such a complex, in fact,

24、simply said to Servlet is a Java class. And t he general category of the difference is that this type operating in a Servlet contain er, which can provide session management and targeted lifecycle management. Sothat when you use the Servlet, you can get all the benefits of the Java platform, incl ud

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

26、ynamic HTML content generated by c ombining an HTML page looks like, but as a Servlet to run. There are many comm ercial application server support JSP technology, such as BEA WebLogic, IBM W ebSphere, JRun, and so on. JSP and Servlet use more than simple. If you have a JS P support for Web servers,

27、 and a 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 hav e to ClassPath settings, you can visit as ordinary Web It did visit, the server will au tomatically help you to do other work.JSP document looks like an ordinary s

28、tatic HTML document, but inside conta ins a number of Java code. It uses. Jsp the suffix, used to tell the server this docum ent 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

29、 then, like other Servlet, from Servlet engine to handle. Servlet engine of this ty pe loading, handling requests from customers, and the results returned to the custo mer.After another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded direc

30、tly call the Servlet. If you have al ready 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 implementat ion of a series of the above process, so wi

31、ll spend some time after such a visit woul d not.Java servlets offer a powerful API that provides access to all the information a bout the request, the session, and the application. combining JSP with servlets lets you clearly separate the application logic from the presentation of the application;

32、i n other words, 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 processing a request and producing a response. Its implemented using the classes and

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

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

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

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

37、( ), doPut( ), and doTra ce( ). Typically you dont implement these methods; the HttpServlet class already t akes care of HEAD, OPTIONS, and TRACE requests in a way thats suitable for m ost servlets, and the DELETE and PUT HTTP methods are rarely used in a web ap plication.Its important to realize th

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

39、to instance variables if you modify the referenced objects only i n the init( ) and destroy( ) methods, and just read them in the request processing m ethods.Compiling and Installing a ServletTo compile a servlet, you must first ensure that you have the JAR file containi ng all Servlet API classes i

40、n 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 JAR file in the CLASSPATH.Reading a RequestOne of the arguments passed to the doGet(

41、 ) and doPost( ) methods is an obje ct that implements the HttpServletRequest interface. This interface defines method s 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 Htt pServletRe

42、sponse 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 ListenersThe servlet specification defines two compon

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

44、ted for a servlet, JSP page, or static page, as well as the response before its sent to the client. This make s it easy to centralize tasks that apply to all requests, such as access control, loggin g, and charging for the content or the services offered by the application. A filter h as full access

45、 to the body and headers of the request and response, so it can also per form various transformations. One example is compressing the response body if th eAcceptlanguage request header indicates that the client can handle a compressed re sponse.A filter can be applied to either a specific servlet or

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

47、ded or removed from a session). You could do this by letting the object save d as a sessionattributimplement theHttpSessionBindingListener interface. With the new interfaces introduced in the 2. 3 version of the specification, you can create listeners for servlet context and sessio n lifecycle event

48、s as well as session activation and passivation events (used by a co ntainer 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 att ribute binding events for all sessions in one place, inste

49、ad of placing individual list ener objects in each session.The new types of listeners follow the standard Java event model. In other wor ds, a listener is a class that implements one or more of the listener interfaces. The i nterfaces define methods that correspond to events. The listener class is r

50、egistered with the container when the application starts, and the container then calls the even t 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 need a reference to a data

51、base or some other external datasource and may create an initial information cache in memory to provide fast acces s even to the first request for data. You can include code for initialization of the sh ared resources in the servlet and JSP pages that need them, but a more modular app roach is to pl

52、ace all this code in one place and let the other parts of the application work on the assumption that the resources are already initialized and available. An application lifecycle listener is a perfect tool for this type of resource initialization. This type of listener implements the javax.servlet.

53、ServletContextListener interface,with methods called by the container when the application starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairly complex application.Half the pages are pure controller and business logic pr

54、ocessing, it accesses a datab ase to authenticate users, and most pages require access control. In real life, it woul d likely contain even more pages, for instance, pages for access to a shared docume nt archive, time schedules, and a set of pages for administration. As the application evolves, it

55、may become hard to maintain as a pure JSP application. Its easy to forg et to include the access control code in new pages.This is clearly an application that can benefit from using a combination of JSP pages and the component types defined by the servlet specification for the MVC r oles. Lets look

56、at the main requirements and see how we can map them to appropri ate component types:Database access should be abstracted, to avoid knowledge of a specific data schema or database engine in more than one part of the application: beans in the role of Model can be used to accomplish this.The database

57、access beans must be made available to all other parts of the application when it starts: an application lifecycle event listener is the perfect component type for this task.Only authenticated users must be allowed to use the application: a filter can perform access control to satisfy this requireme

58、nt.Request processing is best done with Java code: a servlet, acting as the Controller fits the bill.It must be easy to change the presentation: this is where JSP shines, acting as the View.Adding servlets, listeners, and filters to the mix minimizes the need for com plex logic in the JSP pages. Pla

59、cing all this code in Java classes instead makes it po ssible to use a regular Java compiler and debugger to fix potential problems.Centralized Request Processing Using a ServletWith a servlet as the common entry point for all application requests, you g ain control over the page flow of the applica

60、tion. The servlet can decide which type of response to generate depending on the outcome of the requested action, such a s returning a common error page for all requests that fail, or different responses de pending on the type of client making the request. With the help from some utility c lasses, i

61、t can also provide services such as input validation, I18N preparations, and in general, encourage a more streamlined approach to request handling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be sa

62、tisfied in many ways. If you have played around a bit with servlets previously, youre probably used to invoking a servlet with a URI tha t starts with /myApp/servlet. This is a convention introduced by Suns Java Web Se rver (JWS), the first product to support servlets before the API was standardized

63、.Most servlet containers support this convention today, even though its not formall y defined in the servlet specification.“”“”At the end, Xiao Bian gives you a passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a pro

64、fessional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you!

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


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