首 页 行业热点 新车 试驾评测 养车用车 车型库
当前位置:首页JSP技术 ---外文文献

JSP技术 ---外文文献

2024-07-21 来源:好土汽车网
导读 JSP技术 ---外文文献
苏州大学文正学院本科生毕业设计(论文)

外文文献

JSP Technology and Servlets

JSP profile

mpanies to participate in the establishment of a dynamic web page technical standaTML web page document (*. htm, *. html) to insert the Java programming paragraph (Scriptlet) and JSP tag (tag), thus JSP documents (*. jsp). Using JSP developmeoperating systems.

nt of the Web application is cross that can run on Linux, is also available for other

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 loomponent-based design, Web-based application development is rapid and easy.he 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 reoriented websites, in order to achieve the estplementation of the server, usually returned to the client is an HTML text, as long as the client browser will be able to visit.

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

JSP 1.0 specification of the final version is launched in September 1999, Deceablishment of dynamic pages needed to function.JSP and Java Servlet, is in the imgic. JSP page logic and web page design and display separation, support reusable c

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 confirmatio

n to the data, because the network speed was quite slow, only then 28.8kbps, the co

d Java code embedded in one of the components.

JS script language synopsis

JS is javascrip, Javascript is one kind the script language which comes by the

Web server in the face of visits JSP page request, the first implementation of t

rds. JSP technology somewhat similar to ASP technology, it is in the traditional H

JSP (JavaServer Pages) is initiated by Sun Microsystems, Inc., with many co

苏州大学文正学院本科生毕业设计(论文)

nfirmation step waste's 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 standard by ECMA orga

(Navigator 2.0) Brendan Eich has invented this language, started from 1996, alreament 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 compilation to be possible the execution document, is also called as great or the batch run document. 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 hnimation, sound and so on. Cites a most common example, when we click in the ho mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterior motives by some are often using. For example joins some destruction computer system's order in the scrt, will then cause the user the system to come under the attack. Therefore the user should act according to visits homepage the trust degree selective security rank, spescript easily. Through “the safe establishment” the dialog box, the choice “the script” under option each kind of establishment may with ease realize to script being forcially regarding these itself content on the illegal homepage, do not permit the use ipt, like this works as the user browsing homepage, once transfers this kind of scripomepage browsing speed, moreover may enrich the homepage performance, like a

e 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 variety of reasons, one

bid and begins using.

JSP and Servlets

The technology of JSP and Servlet is the most important technology which us

mepage the Email address can transfer Outlook Express or the Foxmail this kind of

dy appeared in all Netscape and in the Microsoft browser. The ECMA262 develop

rd. This standard based on JavaScript (Netscape) and JScript (Microsoft). Netscape

nization development and maintenance. ECMA262 is the official JavaScript standa

苏州大学文正学院本科生毕业设计(论文)

of which is already familiar with the Java language for the development of this tecng the concept of Web applications, To achieve a \"one-

hnology are easy to learn Java to the other is \"a preparation, run everywhere\" to bri

quality, reusable, easy to maintain and modify the application. For example, if the d application is extremely complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also cause difficulties. In fact, CSDN thc is not very clear, a large number of HTML and Java code mixed 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, suced and powerful, because of difficulties in programming, and low efficiency, modif technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a good portability, they have been many people believe that the future is the most dynamic site of the future development of technology.bmit a request to the server, the server presented the request Servlet, Servlet responsible for handling requests and generate a response, and then gave the server, and trate 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 procehod of Servlet arrival of the first judgement is what type of request (GET / POST / hen from the server sent to the customer. And the CGI is different, Servlet not gene

Similar to CGI, Servlet support request / response model. When a customer suh as VB, C / C + + or Delphi, and so on. Though the technology of CGI is develope JSP / Servlet forum, can often see some questions, the code is very long, can logi

HEAD…), then calls the appropriate treatment (DoGet / doPost / doHead…) and generate a response.

Although such a complex, in fact, simply said to Servlet is a Java class. And t

he general category of the difference is that this type operating in a Servlet container, which can provide session management and targeted lifecycle management. So

ss is this: When received from the client's request, calling service methods, the met

y complex shortcomings, it is gradually being replaced by the trend. Of all the new

document in HTML embedded Java code too much (script), will lead the develope

ciples of good design, it can be said of separating and content to create high-

prepared everywhere realized.\" And more importantly, if followed some of the prin

苏州大学文正学院本科生毕业设计(论文)

that when you use the Servlet, you can get all the benefits of the Java platform, including the safety of the management, use JDBC access the database and crossplatfo applications.

rm capability. Moreover, Servlet using thread, and can develop more efficient Web

a Servlet. It allows conventional static and dynamic HTML content generated by cercial 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 JSHTML 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 HTML document, but inside contaent in need of special treatment. When we visit a JSP page, the document will first and then, like 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 Servlet. If you have already been modified, it will be once again the implementation of the above process, called \"first person to punishment.\" Because when the first visit to the implementation of a series of the above process, so will spend some time after such a visit woultranslate, compile and load. In fact, this is the so-P support for Web servers, and a JSP document, you can put it Fangdao any static

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; in other words, it lets you use the most appropriate component type for the roles of Model, View and Controller.

d not.

Java servlets offer a powerful API that provides access to all the information a

be translated into a JSP engine Java source files, is actually a Servlet, and compiler,

ins a number of Java code. It uses. Jsp the suffix, used to tell the server this docum

ombining an HTML page looks like, but as a Servlet to run. There are many comm

JSP technology is a key J2EE technology, it at a higher level of abstraction of

苏州大学文正学院本科生毕业设计(论文)

Servlets, Filters, and Listeners

A servlet is a Java class that extends a server with functionality for processinges defined by the Servlet API. The API consists of two packages: the javax.servlet ax.servlet.http package provides HTTP-specific extensions and utility classes. javax.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 javax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet Lifecycle

with the servlet. A servlet for processing HTTP requests typically extends the

a request and producing a response. It's implemented using the classes and interfacpackage contains classes and interfaces that are protocolindependent, while the jav

ance of the servlet class when needed, passes requests to the instance for processinollowing 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( ), doPut( ), and doTraakes care of HEAD, OPTIONS, and TRACE requests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a web ap

It's important to realize that the container creates only one instance of each servlet. This means that the servlet must be thread safe -ad through the servlet code. Without getting lost in details, you satisfy this requireplication.

ce( ). Typically you don't implement these methods; the HttpServlet class already t

ment with regards to instance 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

able to handle multiple requests at the same time, each executing as a separate thre

g, and eventually removes the instance. For an HttpServlet, the container calls the f

The web container manages all aspects of the servlet's lifecycle. It creates an inst

What makes a servlet a servlet is that the class implements an interface named

苏州大学文正学院本科生毕业设计(论文)

To compile a servlet, you must first ensure that you have the JAR file containi

ng all Servlet API classes in the CLASSPATH environment variable. The JAR file is distributed with all web containers. Tomcat includes it in a file called servlet.jar, file in the CLASSPATH.

Reading a Request

located in the common/lib directory. On a Windows platform, you include the JAR

ct that implements the HttpServletRequest interface. This interface defines method

Generating a Response

Besides the request object, the container passes an object that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. It also defines methods for setting the response status code and headers. Using Filters and Listeners

This interface defines methods for getting a writer or stream for the response body.

The servlet specification defines two component types beside servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if yofraid you're out of luck.

Filters

u're using a container that doesn't yet support this version of the specification, I'm a

A filter is a component that can intercept a request targeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makeg, and charging for the content or the services offered by the application. A filter h

as full access 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 the

Acceptlanguage request header indicates that the client can handle a compressed response.

s it easy to centralize tasks that apply to all requests, such as access control, loggin

s that provide access to a wealth of information about the request.

One of the arguments passed to the doGet( ) and doPost( ) methods is an obje

苏州大学文正学院本科生毕业设计(论文)

A filter can be applied to either a specific servlet or to all requests matching a e extension.

Listeners

URL pattern, such as URLs starting with the same path elements or having the sam

Listeners allow your application to react to certain events. Prior to Servlet 2.3,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 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 attener objects in each session.

ribute binding events for all sessions in one place, instead of placing individual list

nterfaces 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 Listener

instance, they may need a reference to a database or some other external data source and may create an initial information cache in memory to provide fast accesared resources in the servlet and JSP pages that need them, but a more modular app

roach is to place 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 This type of listener implements the javax.servlet.ServletContextListener interface,

application lifecycle listener is a perfect tool for this type of resource initialization.

s even to the first request for data. You can include code for initialization of the sh

Beans like this typically need to be initialized before they can be used. For

ds, a listener is a class that implements one or more of the listener interfaces. The i

The new types of listeners follow the standard Java event model. In other wor

you could handle only session attribute binding events (triggered when an object

苏州大学文正学院本科生毕业设计(论文)

with methods called by the container when the application starts and when it shuts down.

Picking the Right Component Type for Each Task

ase to authenticate users, and most pages require access control. In real life, it woulnt archive, time schedules, and a set of pages for administration. As the application evolves, it may become hard to maintain as a pure JSP application. It's easy to forg

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 roles. Let's look at the main requirements and see how we can map them to appropriate 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 rThe database 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 Request processing is best done with Java code: a servlet, acting as the It must be easy to change the presentation: this is where JSP shines, acting as Adding servlets, listeners, and filters to the mix minimizes the need for com

et to include the access control code in new pages.

perform access control to satisfy this requirement. Controller fits the bill.the View.

plex logic in the JSP pages. Placing 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 Servlet

With a servlet as the common entry point for all application requests, you g

ain control over the page flow of the application. The servlet can decide which typ

ole of Model can be used to accomplish this.

d likely contain even more pages, for instance, pages for access to a shared docume

Half the pages are pure controller and business logic processing, it accesses a datab

The Project Billboard application introduced is a fairly complex application.

苏州大学文正学院本科生毕业设计(论文)

e of response to generate depending on the outcome of the requested action, such as 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 cin general, encourage a more streamlined approach to request handling.

pass through it. This can be satisfied in many ways. If you have played around a bitt starts with /myApp/servlet. This is a convention introduced by Suns Java Web Server (JWS), the first product to support servlets before the API was standardized. Most servlet containers support this convention today, even though it's not formally defined in the servlet specification.

with servlets previously, you're probably used to invoking a servlet with a URI tha

The first requirement for using a Controller servlet is that all requests must

Mapping Application Requests to the Servlet

lasses, it can also provide services such as input validation, I18N preparations, and

因篇幅问题不能全部显示,请点此查看更多更全内容