毕业论文外文文献翻译JSP的技术发展历史the-technique-development-history-of-jsp
JSP外文文献原稿和译文
外文文献原稿和译文原稿JSPJSP (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 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 tocomplete. 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 page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a competing technology; it is a complementary one.It is also possible to use JavaScript on the server, most notably on Sun ONE (formerly iPlanet), IIS, and BroadVision servers. However, Java is more powerful, flexible, reliable, and portable.JSP (a recursive acronym for "JSP: Hypertext Preprocessor") is a free, open-source, HTML-embedded scripting language that is somewhat similar to both ASP and JSP. One advantage of JSP is that the dynamic part is written in Java, which already has an extensive API for networking, database access, distributed objects, and the like, whereas PHP requires learning an entirely new, less widely used language. A second advantage is that JSP is much more widely supported by tool and server vendors than is JSP.Versus Pure Servlets.JSP doesn't provide any capabilities that couldn't, in principle, be accomplished with servlets. In fact, JSP documents are automatically translated into servlets behind the scenes. But it is more convenient to write (and to modify!) regular HTML than to use a zillion println statements to generate the HTML. Plus, by separating the presentation from the content, you can put different people on different tasks: your Web page design experts can build the HTML by using familiar tools and either leave places for your servlet programmers to insert the dynamic content or invoke the dynamic content indirectly by means of XML tags.JSP technology strength(1)time to prepare, run everywhere. At this point Java better than PHP, in addition to systems, the code not to make any changes.(2)the multi-platform support. Basically on all platforms of any development environment, in any environment for deployment in any environment in the expansion. Compared ASP / PHP limitations are obvious.(3) a strong scalability. From only a small Jar documents can run Servlet JSP, to the multiple servers clustering and load balancing, to multiple Application for transaction processing, information processing, a server to numerous servers, Java shows a tremendous Vitality.(4)diversification and powerful development tools support. This is similar to the ASP, Java already have many very good development tools, and many can be free, and many of them have been able to run on a variety of platforms under.JSP technology vulnerable:(1)and the same ASP, Java is the advantage of some of its fatal problem. It is precisely because in order to cross-platform functionality, in order to extreme stretching capacity, greatly increasing the complexity of the product.(2)Java's speed is class to complete the permanent memory, so in some cases by the use of memory compared to the number of users is indeed a "minimum cost performance." On the other hand, it also needs disk space to store a series of. Java documents and. Class, as well as the corresponding versions of documents.Know servlets for four reasons:1.JSP pages get translated into servlets. You can't understand how JSP works without understanding servlets.2.JSP consists of static HTML, special-purpose JSP tags, and Java code. What kind of Java code? Servlet code! You can't write that code if you don't understand servlet programming.3.Some tasks are better accomplished by servlets than by JSP. JSP is good at generating pages that consist of large sections of fairly well structured HTML or other character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve little or no output.4.Some tasks are better accomplished by a combination of servlets and JSP than by either servlets or JSP alone.Versus JavaScriptJavaScript, which is completely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a competing technology; it is a complementary one.JSP is by no means perfect. Many people have pointed out features that could be improved. This is a good thing, and one of the advantages of JSP is that the specification is controlled by a community that draws from many different companies. So, the technology can incorporate improvements in successive releases.However, some groups have developed alternative Java-based technologies to try to address these deficiencies. This, in our judgment, is a mistake. Using a third-party tool like Apache Struts that augments JSP and servlet technology is a good idea when that tool adds sufficient benefit to compensate for the additional complexity. But using a nonstandard tool that tries to replace JSP is a bad idea. When choosing a technology, you need to weigh many factors: standardization, portability, integration, industry support, and technical features. The arguments for JSP alternatives have focused almost exclusively on the technical features part. But portability, standardization, and integration are also very important. For example, the servlet and JSP specifications define a standard directory structure for Web applications and provide standard files (.war files) for deploying Web applications. All JSP-compatible servers must support these standards. Filters can be set up to apply to any number of servlets or JSP pages, but not to nonstandard resources. The same goes for Web application security settings.JSP six built-in objects:request, response, out, session, application, config, pagecontext, page, exception. ONE.Request for:The object of the package of information submitted by users, by calling the object corresponding way to access the information package, namely the use of the target users can access the information.TWO.Response object:The customer's request dynamic response to the client sent the data.THREE.session object1.What is the session: session object is a built-in objects JSP, it in the first JSP pages loaded automatically create, complete the conversation of management.From a customer to open a browser and connect to the server, to close the browser, leaving the end of this server, known as a conversation. When a customer visits a server, the server may be a few pages link between repeatedly, repeatedly refresh a page, the server should be through some kind of way to know this is the same client, which requires session object.2.session object ID: When a customer's first visit to a server on the JSP pages, JSP engines produce a session object, and assigned a String type of ID number, JSP engine at the same time, the ID number sent to the client, stored in Cookie, this session objects, and customers on the establishment of a one-to-one relationship. When a customer to connect to the server of the other pages, customers no longer allocated to the new session object, until, close your browser, the client-server object to cancel the session, and the conversation, and customer relationship disappeared. When a customer re-open the browser to connect to the server, the server for the customer to create a new session object.FORE.aplication target1.What is the application:Servers have launched after the application object, when a customer to visit the site between the various pages here, this application objects are the same, until the server is down. But with the session difference is that all customers of the application objects are the same, that is, all customers share this built-in application objects.2.application objects commonly used methods:(1)public void setAttribute (String key, Object obj): Object specified parameters will be the object obj added to the application object, and to add the subject of the designation of a keyword index.(2)public Object getAttribute (String key): access to application objects containing keywords for.FIVE.out targetsout as a target output flow, used to client output data. out targets for the output data. SIX.Cookie1.What is Cookie:Cookie is stored in Web server on the user's hard drive section of the text. Cookie allow a Web site on the user's computer to store information on and then get back to it.For example, a Web site may be generated for each visitor a unique ID, and then to Cookie in the form of documents stored in each user's machine.If you use IE browser to visit Web, you will see all stored on your hard drive on the Cookie. They are most often stored in places: c: \ windows \ cookies (in Window2000 is in the C: \ Documents and Settings \ your user name \ Cookies)Cookie is "keyword key = value value" to preserve the format of the record.2.Targets the creation of a Cookie, Cookie object called the constructor can create a Cookie. Cookie object constructor has two string parameters: Cookie Cookie name and value.Cookie c = new Cookie ( "username", "john");3.If the JSP in the package good Cookie object to send to the client, the use of the response.addCookie () method.Format: response.addCookie (c)4.Save to read the client's Cookie, the use of the object request getCookies () method will be implemented in all client came to an array of Cookie objects in the form of order, to meet the need to remove the Cookie object, it is necessary to compare an array cycle Each target keywords.译文JSPJSP(JavaServer Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。
外文翻译---JSP的技术发展历史
THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource:Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENERALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progressto the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual "embrace and extend" strategy. At this point, Gosling lightheartedly interjected "You mean disgrace and distend."Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company of the aforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language.However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and theexpression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
JSP技术---外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign 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, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to function.JSP and Java Servle t, is in the implementation of the server, usually return ed to the client is an HTML text, as long as the clien t 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 n orms of the draft has also been introduced.JSP pages from HTML code and Java code embedded in one of the compone nts.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmation to the data, because the network speed was quite slow, only then 28.8kbps, the con firmation step waste's time were too many. Therefore Netsc ape browser Navigator has joined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator 2.0) Brendan Eich has invented this langua ge, started from 1996, already appeared in all Netscape a nd in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has ac cepted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scaleand raises the homepage browsing speed, moreover may enr ich the homepage performance, like animation, sound and soon. Cites a most common example, when we click in the homepage the Email address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-prepared everywhere realized." And more importantly, if fol lowed 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 applica tion. For example, if the document in HTML embedded Javacode too much (script), will lead the developed applicat ion is extremely complex, difficult to read, it is not e asy reuse, but also for future maintenance and modificatio n will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code i s very long, can logic is not very clear, a large numbe r of HTML and Java code mixed together. This is the ran dom development of the defects.Early dynamic pages mainly CGI (Common Gateway Interfac e, public Gateway Interface) technology, you can use diffe rent languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combinin g an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling requests from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n fact, this is the so-called "first person to punishment." Because when the firs t visit to the implementation of a series of the above process, so will spend some time after such a visit woul d not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the javax.servlet package contains classes and inte rfaces 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 class imp lements an interface named javax.servlet.Servlet, either dir ectly or by extending one of the support classes. This i nterface defines the methods used by the web container tomanage and interact with theservlet. A servlet for processing HTTP requests typically extends thejavax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suita ble for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the se rvlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib direct ory. On a Windows platform, you include the JAR file in the CLASSPATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a requesttargeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet 2.3, you could handle only sessio n attribute binding events (triggered when 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 interfa ces introduced in the 2.3 version of the specification, y ou can create listeners for servlet context and session l ifecycle events as well as session activation and passivat ion events (used by a container that temporarily saves se ssion state to disk or migrates a session to another ser ver). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual liste ner objects in each session.The new types of listeners follow the standard Java e vent 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 lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface , with methods called by the container when the applicati on starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administrati on. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type 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 depending on the type of client making the request. With the hel p from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
JSP技术 ---外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign and display separation, support reusable component-base d design, Web-based application development is rapid and e asy.Web server in the face of visits JSP page request, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to 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 specification of the final version is launched i n September 1999, December has introduced specifications.At present relatively new is norms, norms of the dr aft has also been pages from HTML code and Java code embedded in one of the components.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmati on to the data, because the network speed was quite slow , only then , the confirmation step waste's time were to o many. Therefore Netscape browser Navigator has joined Ja vascript, has provided the data confirmation basic function .The JavaScript official name is “ECMAScript”.This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has acce pted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scale and raises the homepage browsing speed, moreover may enr ich the homepage performance, 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 of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, likethis works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-pr epared everywhere realized." And more importantly, if follo wed some of the principles of good design, it can be sa id of separating and content to create high-quality, reusa ble, easy to maintain and modify the application. For exa mple, if the document in HTML embedded Java code too muc h (script), will lead the developed application is extreme ly complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also c ause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, c an logic 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 Interfac e, 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 powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combining an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling reques ts from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n 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 some time after such a visit would not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the package contains classes and interfaces that are protocolindependent, while the package provides HTTP -specific extensions and utility classes.What makes a servlet a servlet is that the class imp lements an interface named either directly or by extendi ng one of the support classes. This interface defines the methods used by the web container to manage and interac t with theservlet. A servlet for processing HTTP requests typically extends theclass. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the servlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called , located in the common/lib directory. On a Windows platform, you include the JAR file in the CLASS PATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a request targeted for a servlet, JSP page, or static page, as w ell as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet , you could handle only session attribute binding events (triggered when an object was add ed or removed from a session). You could do this by let ting the object saved as a sessionattributimplement the H ttpSessionBindingListener interface. With the new interfaces introduced in the version of the specification, you ca n create listeners for servlet context and session lifecyc le events as well as session activation and passivation e vents (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 poss ible to deal with attribute binding events for all sessio ns in one place, instead of placing individual listener o bjects in each session.The new types of listeners follow the standard Java e vent model. In other words, a listener is a class that implements one or more of the listener interfaces. The in terfaces define methods that correspond to events. The lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the interface, with methods called by the c ontainer when the application starts and when it shuts do wn.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administrati on. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type of response to generate depending on the outcome of the re quested action, such as returning a common error page for all requests that fail, or different responses depending on the type of client making the request. With the help from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
jsp技术网站设计外文翻译(适用于毕业论文外文翻译+中英文对照)
Combining 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 variety 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 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 extremely 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 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 powerful, because of difficulties in programming, and low efficiency, modify 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 many people 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 response, 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: When received from the client's 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 / doPos t / doHead…) and generate a response.Although such a complex, in fact, simply said to Servlet 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 life-cycle management. So 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 cross-platform 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 dynamic 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 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 HTML 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, 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, as shown below:Figure 1: Calling the process of JSP pagesAfter 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, 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 some 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, 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. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two packages: the javax.servlet package contains classes and interfaces that are protocol-independent, while the javax.servlet.http package provides HTTP-specific extensions and utility classes.What makes a servlet a servlet is that the class implements an interface named 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 with theservlet. A servlet for processing HTTP requests typically extends the javax.servlet.http.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 servlet's lifecycle. It creates an instance of the servlet class when needed, passes requests to the instance for processing, 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( ), doPut( ), and doTrace( ). Typically you don't implement these methods; the HttpServlet class already takes 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 application.It's important to realize that the 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 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing 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, 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( ) 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 HttpServletResponse 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 component types beside servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you'reout of luck.FiltersA 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 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 access 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 Accept-Language request header indicates that the client can handle a compressed response.A filter can be applied to either a 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 when an object was added or removed from a session). You could do this by letting the object saved as a sessionattribute(using the HttpSession.setAttribute() method)implement 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 attribute binding events for all sessions in one 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 need a reference to a database or some other external data source and may create an initial information cache in memory to provide fast access even to the first request for data. You can include code for initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approach 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 application lifecycle listener is a perfect tool for this type of resource initialization. This type of listener implements the javax.servlet.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 thepages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control. In real life, it would likely contain even more pages, for instance, pages for access to a shared document 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 forget 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 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 dataschema or database engine in more than one part of the application: beans in therole of Model can be used to accomplish this.●The database access beans must be made available to all other parts of theapplication when it starts: an application lifecycle event listener is the perfectcomponent type for this task.●Only authenticated users must be allowed to use the application: a filter canperform access control to satisfy this requirement.●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 theView.Adding servlets, listeners, and filters to the mix minimizes the need for complex logic in the JSP pages. Placing all this code in Java classes instead makes it possible 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 gain control over the page flow of the application. The servlet can decide which type 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 depending on the type of client making the request. With the help from some utility classes, it can also provide services such as input validation, I18N preparations, and in general, encourage a more streamlined approach to request handling.When you use a servlet as a Controller, you must deal with the following basic requirements:●All requests for processing must be passed to the single Controller servlet.●The servlet must be able to distinguish requests for different types of processing.Here are other features you will want support for, even though they may not be requirements for all applications:● A strategy for extending the application to support new types of processingA mechanism for changing the page flow of the application without modifyingcode.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bit with servlets previously, you're probably used to invoking a servlet with a URI that 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.将Servlet和JSP组合使用Servlet和JSP技术是用Java开发服务器端应用的主要技术,是开发商务应用表示端的标准。
外文文献翻译
JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Page(JSP)是一种基于web脚本的编译技术,类似于Notespace 公司服务器端的Java脚本语言--server- side JavaScript(SSJS)和微软公司的Active Server Pages(ASP)。
JSP相较于SSJS和ASP具有更好的扩展性,并且它不专属于任何一家厂商或某一特定的Web服务器。
尽管JSP的规范是由SUN公司制定的,但是任何一家厂商都可以在自己的系统上进行JSP的开发。
SUN公司正式推出JSP(Java Server Page)之后,这种新的Web应用开发技术很快引起了人们的关注。
JSP为高度动态的Web应用提供了一个特殊的开发环境。
根据SUN公司的说法,JSP适用于包括Apache Web服务器、IIS4.0 等85%的市场现有的服务器产品。
这一章将介绍JSP和Databases相关知识,以及JavaBean的相关内容,当然仅仅是些基础内容的介绍,可以说只是个引导,如果读者需要了解更详细的内容,请查阅JSP的相关书籍。
1.1概要JSP始发于SUN Microsystems公司,很多公司参与建立的一种动态web页面技术标准,它在动态web页面中具有强大但不独特的功能。
JSP与微软公司的ASP技术非常相似。
它们都提供了在HTML页面中掺入程序代码并且由语言引擎阐述的功能。
下面,我们简单的介绍一下。
JSP页面是由servlet演化而来的。
因此,基本上,任何JSP页面能进行的任务都可以由servlet实现。
然而,基础相等的意思并不是说servlet和JSP页面在所有的情况下都有相同的功效。
问题并不在于技术层面,而是在于两者在便利性、效率和可维护性方面的差异。
毕竟,任何你可以在特定计算机平台上用Java编程语言完成的东西,都可以用汇编语言完成。
外文文献翻译-JSP发展历史中英文
JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java 脚本语言—— server—side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
与SSJS和ASP相比,JSP具有更好的可扩展性,并且它不专属于任何一家厂商或某一特定的Web服务器。
尽管JSP规范是由Sun公司制定的,但任何厂商都可以在自己的系统上实现JSP。
在Sun正式发布JSP(Java Server Pages)之后,这种新的Web应用开发技术很快引起了人们的关注。
JSP为创建高度动态的Web应用提供了一个独特的开发环境。
按照Sun的说法,JSP能够适应市场上包括Apache WebServer、IIS4.0在内的85%的服务器产品。
本文将介绍JSP相关的知识,以及JavaBean的相关内容,当然都是比较粗略的介绍其中的基本内容,仅仅起到抛砖引玉的作用,如果读者需要更详细的信息,请参考相应的JSP的书籍。
1。
1 概述JSP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准,其在动态网页的建设中有其强大而特别的功能。
JSP与Microsoft的ASP技术非常相似.两者都提供在HTML代码中混合某种程序代码、由语言引擎解释执行程序代码的能力。
下面我们简单的对它进行介绍.JSP页面最终会转换成servlet。
因而,从根本上,JSP页面能够执行的任何任务都可以用servlet 来完成。
然而,这种底层的等同性并不意味着servlet和JSP页面对于所有的情况都等同适用.问题不在于技术的能力,而是二者在便利性、生产率和可维护性上的不同。
毕竟,在特定平台上能够用Java 编程语言完成的事情,同样可以用汇编语言来完成,但是选择哪种语言依旧十分重要.和单独使用servlet相比,JSP提供下述好处:1)JSP中HTML的编写与维护更为简单。
外文文献-JSP Technology Conspectus And Specialties
外文文献-JSP Technology Conspectus And Specialties 毕业设计外文文献原文及译文学生姓名: 学号:电子与计算机科学技术系系别:网络工程专业:指导教师:2015年 5 月中北大学信息商务学院2015届毕业设计外文文献原文及译文JSP Technology Conspectus And SpecialtiesThe 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. Therelated 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. TechnicalJSP the development background and development historyIn 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 content of a Web page is based on the user's request or the state of the system, and are not predefined characters.For the problem of an early solution is to use a CGI - BIN interface. Developers write to第 1 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文interface with the relevant procedures and separate based on Web applications, the latter through the Web server to invoke the former. This plan has serious problem -- each new extensible CGI requirements in a new process on the server. If multiple concurrent users access to this procedure, these processes will use the Web server of all available resources, and the performance of the system will be reduced toextremely low.Some Web server providers have to provide for their server byplugins "and" the API to simplify the Web application development. These solutions are associated with certain Web server, cannot solve the span multiple suppliers solutions. For example, Microsoft's Active Server mix (ASP) technology in the Web page to create dynamic content more easily, but also can work in Microsoft on Personal Web Server and IIS.There are other solutions, but cannot make an ordinary pagedesigners can easily master. For example, such as the Servlet Java technologies can use Java language interaction application server code easier. Developers to write such Servlet to receive signals from the Web browser to generate an HTTP request, a dynamic response (may be inquires the database to finish the request), then send contain HTML or XML documents to the response of the browser.note: one is based on a Java Servlet Java technical operation in the server program (with different, the latter operating in the Applet browser end). In this book the Servlet chapter 4.Using this method, the entire page must have made in Java Servlet.If developers or Web managers want to adjust page, you'll have to edit and recompile the Servlet Java, even in logic has been able to run. Using this method, the dynamic content with the application of the page still need to develop skills.Obviously, what is needed is a industry to create dynamic content within the scope of the pages of the solution. This program will solve the current scheme are limited. As follows:can on any Web server or applications.will application page displays and separation.can rapidly developing and testing.simplify the interactive development based on Web application process.The JSP technology is designed to meet such requirements. The JSP specification is a Web server, application server, trading system and develop extensive cooperation between the tool suppliers. From this standard to develop the existing integration and balance of Java programming environment (for example, Java Servlet and JavaBeans) support techniques and tools. The result is a kind of new and developing method based on Web applications, using第 2 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文component-based application logic page designers with powerful functions.Overall Semantics of a JSP PageA JSP page implementation class defines a _jspService() method mapping from the request to the response object. Some details of this transformation are specific to the scripting language used (see Chapter JSP.9, “Scripting”). Most details are not language specific and are described in this chapter.The content of a JSP page is devoted largely to describing the data that is written into the output stream of the response. (The JSP container usually sends this data back to the client.) The description is based on a JspWriter object that is exposed through the implicit object out (see Section JSP.1.8.3, “Implicit Objects”). Its value varies:Initially, out is a new JspWriter object. This object may bedifferent from the stream object returned from response.getWriter(), and may be considered to be interposed on the latter in order to implement buffering (see Section JSP.1.10.1, “The page Directive”). This is the initial out object. JSP page authors are prohibited from writingdirectly to either the PrintWriter or OutputStream associated with the ServletResponse.The JSP container should not invoke response.getWriter() until the time when the first portion of the content is to be sent to the client.This enables a number of uses of JSP, including using JSP as a language to “glue” actions that deliver binary content, or reliably forwarding to a servlet, or change dynamically the content type of the response before generating content. See Chapter JSP.4, “Internationalization Issues”.Within the body of some actions, out may be temporarily re-assigned to a different (nested) instance of a JspWriter object. Whether this is the case depends on the details of the action’s semantics. Typically the content of these temporary streams is appended to the stream previously referred to by out, and out is subsequently re-assignedto refer to the previous (nesting) stream. Such nested streams are always buffered, and require explicit flushing to a nesting stream or their contents will be discarded.If the initial out JspWriter object is buffered, then depending upon the value of the autoFlush attribute of the page directive, the content of that buffer will either be automatically flushed out to the ServletResponse output stream to obviate overflow, or an exception shall be thrown to signal buffer overflow. If the initial out JspWriter is unbuffered, then content written to it will be passed directly through to the ServletResponse output stream.A JSP page can also describe what should happen when some specific events occur. In JSP 2.1, the only events that can be described are the initialization and the destruction of the第 3 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文page. These events are described using “well-known method names”in declaration elements..JavaScript is used for the first kind is browser, the dynamicgeneral purpose of client scripting language. Netscape first proposed in 1995, but its JavaScript LiveScript called. Then quickly Netscape LiveScript renamed JavaScript, Java developers with them from the same issued a statement. A statement Java and JavaScript will complement each other, but they are different, so the technology of the many dismissed the misunderstanding of the two technologies.JavaScript to create user interface control provides a scripting language. In fact, in the browser into the JavaScript code logic. It can support such effect: when the cursor on the Web page of a mobile user input validation or transform image.Microsoft also write out their JavaScript version and the JScript called. Microsoft and Netscape support JavaScript and JScript around a core characteristics and European Manufacturers is.md by (ECMA) standards organization, the control standard of scripting language. ECMA its scripting language ECMAScript named.Servlets and JSPs often include fragments of information that are common to an organization, such as logos, copyrights, trademarks, or navigation bars. The web application uses the include mechanisms to import the information wherever it is needed, since it is easier to change content in one place then to maintain it in every piece of codewhere it is used. Some of this information is static and either never or rarely changes, such as an organization's logo. In other cases, the information is more dynamic and changes often and unpredictably, such as a textual greeting that must be localized for each user. In both cases, you want to ensure that the servlet or JSP can evolve independently ofits included content, and that the implementation of the servlet or JSP properly updates its included content as necessary.You want to include a resource that does not change very much (suchas a page fragment that represents a header or footer) in a JSP. Use the include directive in the including JSP page, and give the included JSP segment a .jspf extension.You want to include content in a JSP each time it receives a request, rather than when the JSP is converted to a servlet. Use the jsp:include standard action.You want to include a file dynamically in a JSP, based on a value derived from a configuration file. Use the jsp:include standard action. Provide the value in an external properties file or as a configuration parameter in the deployment descriptor.You want to include a fragment of an XML file inside of a JSP document, or include a JSP page in XML syntax. Use the jsp:include standard action for the includes that you want to第 4 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文occur with each request of the JSP. Use the jsp:directive.include element if the include action should occur during the translation phase.You want to include a JSP segment from outside the including file's context. Use the c:importThe operation principle and the advantages of JSP tagsIn this section of the operating principle of simple introductionJSP and strengths.For the first time in a JSP documents requested by the engine, JSP Servlet is transformed into a document JSP. This engine is itself a Servlet. The operating process of the JSP shown below:(1) the JSP engine put the JSP files converting a Java source files (Servlet), if you find the files have any grammar mistake JSP,conversion process will interrupt, and to the server and client output error messages.(2) if converted, with the engine JSP javac Java source filecompiler into a corresponding scale-up files.(3) to create a the Servlet (JSP page), the transformation of the Servlet jspInit () method was executed, jspInit () method in the life cycle of Servlet executed only once.(4) jspService () method invocation to the client requests. For each request, JSP engine to create a new thread for processing the request.If you have multiple clients and request the JSP files, JSP engine will create multiple threads. Each client requests a thread. To executemulti-thread can greatly reduce the requirement of system resources,improving the concurrency value and response time. But also should notice the multi-thread programming, due to the limited Servlet always in response to memory, so is very fast.(5) if the file has been modified. The JSP, server will be set according to the document to decide whether to recompile, if need to recompile, will replace the Servlet compile the memory and continue the process.(6) although the JSP efficiency is high, but at first when the need to convert and compile and some slight delay. In addition, if at any time due to reasons of system resources, JSP engine will in some way of uncertain Servlet will remove from memory. When this happens jspDestroy () method was first call.第 5 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文(7) and then Servlet examples were marked with "add" garbage collection. But in jspInit () some initialization work, if establish connection with database, or to establish a network connection, from a configuration file take some parameters, such as, in jspDestory () release of the corresponding resources.Based on a Java language has many other techniques JSP page dynamic characteristics, technical have embodied in the following aspects: One simplicity and effectiveness:The JSP dynamic web pages with the compilation ofthe static HTML pages of writing is very similar. Just in theoriginal HTML page add JSP tags, or some of the proprietary scripting (this is not necessary). So, a familiar with HTML page write design personnel may be easily performed JSP page development. And the developers can not only, and write script by JSP tags used exclusively others have written parts to realize dynamic pages. So, an unfamiliar with the web developers scripting language, can use the JSP make beautiful dynamic pages. And this in other dynamic web development is impossible.Tow the independence of the program:The JSP are part of the familyof the API Java, ithas the general characteristics of the cross-platform Java program. In other words, is to have the procedure, namely the independence of the platform, 6 Write bided anywhere! .Three procedures compatibility:The dynamic content can various JSP form, so it canshow for all kinds of customers, namely from using HTML/DHTML browser to use various handheld wireless equipment WML (for example, mobile phones and pdas), personal digital equipment to use XML applications, all can use B2B JSP dynamic pages.Four program reusability:In the JSP page can not directly, but embedded scriptingdynamic interaction will be cited as a component part. So, once such a component to write, it can be repeated several procedures, the programof the reusability. Now, a lot of standard JavaBeans library is a good example.第 6 页共 19 页中北大学信息商务学院2015届毕业设计外文文献原文及译文JSP技术简介及特点JSP(Java Server Pages)技术是由Sun公司发布的用于开发动态Web应用的一项技术。
JSP技术 ---外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign and display separation, support reusable component-base d design, Web-based application development is rapid and e asy.Web server in the face of visits JSP page request, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to function.JSP and Java Servle t, is in the implementation of the server, usually return ed to the client is an HTML text, as long as the clien t 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 n orms of the draft has also been introduced.JSP pages from HTML code and Java code embedded in one of the compone nts.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmati on to the data, because the network speed was quite slow , only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has jo ined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”.This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator 2.0) Brendan Eich has invented this langua ge, started from 1996, already appeared in all Netscape a nd in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has ac cepted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scaleand raises the homepage browsing speed, moreover may enr ich the homepage performance, like animation, sound and soon. Cites a most common example, when we click in the homepage the Email address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-pr epared everywhere realized." And more importantly, if follo wed some of the principles of good design, it can be sa id of separating and content to create high-quality, reusa ble, easy to maintain and modify the application. For exa mple, if the document in HTML embedded Java code too much (script), will lead the developed application is extreme ly complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also c ause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, c an logic 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 Interfac e, public Gateway Interface) technology, you can use diffe rent languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combinin g an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling requests from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n 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 some time after such a visit would not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the javax.servlet package contains classes and inte rfaces 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 class imp lements an interface named javax.servlet.Servlet, either dir ectly or by extending one of the support classes. This i nterface defines the methods used by the web container to manage and interact with theservlet. A servlet for processing HTTP requests typically extends thejavax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suita ble for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the se rvlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib direct ory. On a Windows platform, you include the JAR file in the CLASSPATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a requesttargeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet 2.3, you could handle only sessio n attribute binding events (triggered when 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 interfa ces introduced in the 2.3 version of the specification, y ou can create listeners for servlet context and session l ifecycle events as well as session activation and passivat ion events (used by a container that temporarily saves se ssion state to disk or migrates a session to another ser ver). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual liste ner objects in each session.The new types of listeners follow the standard Java e vent 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 lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface , with methods called by the container when the applicati on starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administrati on. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type 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 depending on the type of client making the request. With the hel p from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
外文文献及翻译-JSP发展历史中英文
外文文献及翻译-JSP发展历史中英文THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENERALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particularcomputer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of) The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant,actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual "embrace and extend" strategy. At this point, Gosling lightheartedly interjected "You mean disgrace and distend."Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company of the aforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScriptand VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of thebusiness and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. Thenext in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert BatesJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
JSP的技术发展历史 外文文献和翻译资料 中英文对照
外文资料原文THE TECHNIQUE DEVELOPMENT HISTORY OF JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.1.1 GENER ALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.1.2 JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit andtranslate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.3 JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes bethe procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floorJavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the normand the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.外文资料译文JSP的技术发展历史Java Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
JSP的技术发展-中英文文献翻译
THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource:Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENERALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and makeuse of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual "embrace and extend" strategy. At this point, Gosling lightheartedly interjected "You mean disgrace and distend."Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company of the aforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP also allows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in theJSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily.However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can beJavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently.Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
JSP技术---外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign and display separation, support reusable component-base d design, Web-based application development is rapid and e asy.Web server in the face of visits JSP page request, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to function.JSP and Java Servle t, is in the implementation of the server, usually return ed to the client is an HTML text, as long as the clien t 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 n orms of the draft has also been introduced.JSP pages from HTML code and Java code embedded in one of the compone nts.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmati on to the data, because the network speed was quite slow , only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has jo ined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”. This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator 2.0) Brendan Eich has invented this langua ge, started from 1996, already appeared in all Netscape a nd in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has ac cepted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scaleand raises the homepage browsing speed, moreover may enr ich the homepage performance, like animation, sound and soon. Cites a most common example, when we click in the homepage the Email address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-pr epared everywhere realized." And more importantly, if follo wed some of the principles of good design, it can be sa id of separating and content to create high-quality, reusa ble, easy to maintain and modify the application. For exa mple, if the document in HTML embedded Java code too much (script), will lead the developed application is extreme ly complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also c ause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, c an logic 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 Interfac e, public Gateway Interface) technology, you can use diffe rent languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combinin g an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling requests from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n 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 some time after such a visit would not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the javax.servlet package contains classes and inte rfaces 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 class imp lements an interface named javax.servlet.Servlet, either dir ectly or by extending one of the support classes. This i nterface defines the methods used by the web container to manage and interact with theservlet. A servlet for processing HTTP requests typically extends thejavax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suita ble for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the se rvlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib direct ory. On a Windows platform, you include the JAR file in the CLASSPATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a requesttargeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet 2.3, you could handle only sessio n attribute binding events (triggered when 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 interfa ces introduced in the 2.3 version of the specification, y ou can create listeners for servlet context and session l ifecycle events as well as session activation and passivat ion events (used by a container that temporarily saves se ssion state to disk or migrates a session to another ser ver). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual liste ner objects in each session.The new types of listeners follow the standard Java e vent 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 lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface , with methods called by the container when the applicati on starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administrati on. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type 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 depending on the type of client making the request. With the hel p from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
JAVA毕业设计外文文献翻译
THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource: Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JS P( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Webapplication that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on themarket at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENER ALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriatein all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which youchoose.JSP provides the following benefits over servlets alone: • It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags. • You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content. Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the apGFDGpropriate tool for the job, and servlets, by themselves, do not completeyour toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changesaccording to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer neednot use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high.But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP.A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual "embrace and extend" strategy. At this point,Gosling lightheartedly interjected "You mean disgrace and distend." Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their ownpurposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company of theaforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP alsoallows to use other languages.1.3JSP CHARACTERISTICSIs a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP.Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents.Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+;PHP3 → PHP4.In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java.1.4JSP MECHANISMTo comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and"the page develops for the web page of the center" first.The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously.At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm.Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans.See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs.Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets.The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java.Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again andefficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently. Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Webapplication procedure very expediently.JSP的技术发展历史作者:Kathy Sierra and Bert Bates来源:Servlet&JSPJava Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言——server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。
JSP技术----外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign 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, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to 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 specification of the final version is launched i n September 1999, December has introduced specifications.At present relatively new is norms, norms of the dr aft has also been pages from HTML code and Java code embedded in one of the components.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmation to the data, because the network speed was quite slow, only then , the confirmatio n step waste's time were too many. Therefore Netscape bro wser Navigator has joined Javascript, has provided the dat a confirmation basic function.The JavaScript official name is “ECMAScript”.This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator Brendan Eich has invented this language, started from 1996, already appeared in all Netscape and in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has acce pted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scale and raises the homepage browsing speed, moreover may enr ich the homepage performance, 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 of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, likethis works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-prepared everywhere realized." And more importantly, if fol lowed 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 applica tion. For example, if the document in HTML embedded Java code too much (script), will lead the developed applicat ion is extremely complex, difficult to read, it is not e asy reuse, but also for future maintenance and modificatio n will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code i s very long, can logic is not very clear, a large numbe r of HTML and Java code mixed together. This is the ran dom development of the defects.Early dynamic pages mainly CGI (Common Gateway Interfac e, 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 powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combining an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling reques ts from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n fact, this is the so-called "first person to punishment." Because when the firs t visit to the implementation of a series of the above process, so will spend some time after such a visit woul d not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in other words, it lets you usethe 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the package contains classes and interfaces that are protocolindependent, while the package provides HTTP -specific extensions and utility classes.What makes a servlet a servlet is that the class imp lements an interface named either directly or by extendi ng one of the support classes. This interface defines the methods used by the web container to manage and interac t with theservlet. A servlet for processing HTTP requests typically extends theclass. This class implements the Servlet interface and provides additional methods suitable for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the se rvlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called , located in the common/lib directory. On a Windows platform, you include the JAR file in the CLASS PATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet specification, so if you're us ing a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a request targeted for a servlet, JSP page, or static page, as w ell as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet , you could handle only session attribute binding events (triggered when an object was add ed or removed from a session). You could do this by let ting the object saved as a sessionattributimplement the H ttpSessionBindingListener interface. With the new interfaces introduced in the version of the specification, you ca n create listeners for servlet context and session lifecyc le events as well as session activation and passivation e vents (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 sessio ns in one place, instead of placing individual listener o bjects in each session.The new types of listeners follow the standard Java e vent model. In other words, a listener is a class that implements one or more of the listener interfaces. The in terfaces define methods that correspond to events. The lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the interface, with methods called by the c ontainer when the application starts and when it shuts do wn.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administration. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type 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 depending on the type of client making the request. With the hel p from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
JSP技术 ---外文文献
外文文献JSP Technology and ServletsJSP profileJSP (JavaServer Pages) is initiated by Sun Microsystems , Inc., with many companies to participate in the establi shment of a dynamic web page technical standards. JSP tec hnology 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 devel opment of the Web application is cross that can run on Linux, is also available for other operating systems.JSP technology to use the Java programming language pr epared by the category of XML tags and scriptlets, to pr oduce dynamic pages package processing logic. Page also vi sit by tags and scriptlets exist in the services side of the resources of logic. JSP page logic and web page de sign and display separation, support reusable component-base d design, Web-based application development is rapid and e asy.Web server in the face of visits JSP page request, t he first implementation of the procedures of, and then to gether with the results of the implementation of JSP docu ments in HTML code with the return to the customer. Inse rt the Java programming operation of the database can be reoriented websites, in order to achieve the establishmen t of dynamic pages needed to function.JSP and Java Servle t, is in the implementation of the server, usually return ed to the client is an HTML text, as long as the clien t 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 n orms of the draft has also been introduced.JSP pages from HTML code and Java code embedded in one of the compone nts.JS script language synopsisJS is javascrip, Javascript is one kind the script la nguage which comes by the Netscape LiveScript development, the main purpose is to solve the server terminal langua ge, for instance Perl, carry-over speed question. At that time served the end to need to carry on the confirmati on to the data, because the network speed was quite slow , only then 28.8kbps, the confirmation step waste's time were too many. Therefore Netscape browser Navigator has jo ined Javascript, has provided the data confirmation basic function.The JavaScript official name is “ECMAScript”.This st andard by ECMA organization development and maintenance. EC MA262 is the official JavaScript standard. This standard b ased on JavaScript (Netscape) and JScript (Microsoft). Nets cape (Navigator 2.0) Brendan Eich has invented this langua ge, started from 1996, already appeared in all Netscape a nd in the Microsoft browser. The ECMA262 development began in 1996, in 1997 July, the ECMA general meeting has ac cepted its first edition.The script uses one specific descriptive language, rest s on certain form compilation to be possible the executio n document, is also called as great or the batch run do cument. 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, becaus e the script not only may reduce the homepage the scaleand raises the homepage browsing speed, moreover may enr ich the homepage performance, like animation, sound and soon. Cites a most common example, when we click in the homepage the Email address can transfer Outlook Express or the Foxmail this kind of mail software automatically, is realizes through the script function. Also because of script these characteristics, the human who harbors ulterio r motives by some are often using. For example joins som e destruction computer system's order in the script, like this works as the user browsing homepage, once transfers this kind of script, will then cause the user the syst em to come under the attack. Therefore the user should a ct according to visits homepage the trust degree selective security rank, specially regarding these itself content o n the illegal homepage, do not permit the use script eas ily. Through “the safe establishment”the dialog box, th e choice “the script”under option each kind of establi shment may with ease realize to script being forbid and begins using.JSP and ServletsThe technology of JSP and Servlet is the most importa nt technology which use Javatechnology to exploit request of server, and it is al so the standard which exploit business application .Java d evelopers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Ja va to the other is "a preparation, run everywhere" to br ing the concept of Web applications, To achieve a "one-pr epared everywhere realized." And more importantly, if follo wed some of the principles of good design, it can be sa id of separating and content to create high-quality, reusa ble, easy to maintain and modify the application. For exa mple, if the document in HTML embedded Java code too much (script), will lead the developed application is extreme ly complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also c ause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, c an logic 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 Interfac e, public Gateway Interface) technology, you can use diffe rent languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in pr ogramming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all th e new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a go od portability, they have been many people believe that t he future is the most dynamic site of the future develop ment of technology.Similar to CGI, Servlet support request / response mod el. When a customer submit 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 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 proces s. It threads through the use of technology, reduce the server costs. Servlet handling of the request process is this: When received from the client's request, calling ser vice 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 Serv let is a Java class. And the general category of the di fference is that this type operating in a Servlet contain er, which can provide session management and targeted life cycle management. So 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 datab ase and crossplatform capability. Moreover, Servlet using t hread, and can develop more efficient Web applications.JSP technology is a key J2EE technology, it at a hig her level of abstraction of a Servlet. It allows conventi onal static and dynamic HTML content generated by combinin g an HTML page looks like, but as a Servlet to run. Th ere are many commercial application server support JSP tec hnology, such as BEA WebLogic, IBM WebSphere, JRun, and s o on. JSP and Servlet use more than simple. If you have a JSP support for Web servers, 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 have to ClassPath settings, you can visit as ordinary W eb It did visit, the server will automatically help you to do other work.JSP document looks like an ordinary static HTML docume nt, 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, like other Servlet, from Servlet engine to ha ndle. Servlet engine of this type loading, handling requests from customers, and the results returned to the custom er.After another visit this page to the customer, as lon g as the paper there have been no changes, JSP engine h as been loaded directly call the Servlet. If you have al ready been modified, it will be once again the implementa tion of the above process, translate, compile and load. I n 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 some time after such a visit would not.Java servlets offer a powerful API that provides acces s to all the information about the request, the session, and the application. combining JSP with servlets lets yo u clearly separate the application logic from the presenta tion of the application; in 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 r esponse. It's implemented using the classes and interfaces defined by the Servlet API. The API consists of two pa ckages: the javax.servlet package contains classes and inte rfaces 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 class imp lements an interface named javax.servlet.Servlet, either dir ectly or by extending one of the support classes. This i nterface defines the methods used by the web container to manage and interact with theservlet. A servlet for processing HTTP requests typically extends thejavax.servlet.http.HttpServlet class. This class implements the Servlet interface and provides additional methods suita ble for HTTP processing.Servlet LifecycleThe web container manages all aspects of the servlet's l ifecycle. It creates an instance of the servlet class whe n needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropr iate times in the servlet lifecycle.Besides the doGet( ) and doPost( ) methods, there are m ethods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Ty pically you don't implement these methods; the HttpServle t class already takes care of HEAD, OPTIONS, and TRACE r equests in a way that's suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a we b application.It's important to realize that the container creates o nly one instance of each servlet. This means that the se rvlet must be thread safe - able to handle multiple requ ests at the same time, each executing as a separate thre ad through the servlet code. Without getting lost in deta ils, you satisfy this requirement 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 ServletTo compile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is dist ributed with all web containers. Tomcat includes it in a file called servlet.jar, located in the common/lib direct ory. On a Windows platform, you include the JAR file in the CLASSPATH.Reading a RequestOne of the arguments passed to the doGet( ) and doPo st( ) methods is an object that implements the HttpServle tRequest interface. This interface defines methods that pro vide access to a wealth of information about the request.Generating a ResponseBesides the request object, the container passes an objec t that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This int erface 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 component types besi de servlets: filters and listeners. These two types were introduced in the Servlet 2.3 specification, so if you're using a container that doesn't yet support this version of the specification, I'm afraid you're out of luck.FiltersA filter is a component that can intercept a requesttargeted for a servlet, JSP page, or static page, as well as the response before it's sent to the client. This makes it easy to centralize tasks that apply to all re quests, such as access control, logging, and charging for the content or the services offered by the application.A filter has full access to the body and headers of t he request and response, so it can also perform various transformations. One example is compressing the response bo dy if the Acceptlanguage request header indicates that th e client can handle a compressed response.A filter can be applied to either a specific servlet or to all requests matching a URL pattern, such as URL s starting with the same path elements or having the sam e extension.ListenersListeners allow your application to react to certain e vents. Prior to Servlet 2.3, you could handle only sessio n attribute binding events (triggered when 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 interfa ces introduced in the 2.3 version of the specification, y ou can create listeners for servlet context and session l ifecycle events as well as session activation and passivat ion events (used by a container that temporarily saves se ssion state to disk or migrates a session to another ser ver). A newsession attribute event listener also makes it possible to deal with attribute binding events for all sessions in one place, instead of placing individual liste ner objects in each session.The new types of listeners follow the standard Java e vent 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 lis tener class is registered with the container when the app lication starts, and the container then calls the event m ethods at the appropriate times.Initializing Shared Resources Using a ListenerBeans like this typically need to be initialized befor e they can be used. Forinstance, they may need a reference to a database or some other external data source and may create an initi al information cache in memory to provide fast access eve n to the first request for data. You can include code f or initialization of the shared resources in the servlet and JSP pages that need them, but a more modular approac h is to place all this code in one place and let the other parts of the application work on the assumption tha t the resources are already initialized and available. An application lifecycle listener is a perfect tool for thi s type of resource initialization. This type of listener implements the javax.servlet.ServletContextListener interface , with methods called by the container when the applicati on starts and when it shuts down.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairl y complex application. Half the pages are pure controller and business logic processing, it accesses a database to authenticate users, and most pages require access control . In real life, it would likely contain even more pages, for instance, pages for access to a shared document arc hive, time schedules, and a set of pages for administrati on. As the application evolves, it may become hard to ma intain as a pure JSP application. It's easy to forget 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 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 knowledg e of a specific dataschema 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 access beans must be made available to a ll other parts of theapplication 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 appli cation: a filter canperform access control to satisfy this requirement.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 m inimizes the need for complex logic in the JSP pages. Pl acing all this code in Java classes instead makes it pos sible 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 a pplication requests, you gain control over the page flowof the application. The servlet can decide which type 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 depending on the type of client making the request. With the hel p from some utility classes, it can also provide services such as input validation, I18N preparations, and in gene ral, encourage a more streamlined approach to request hand ling.Mapping Application Requests to the ServletThe first requirement for using a Controller servlet is that all requests must pass through it. This can be satisfied in many ways. If you have played around a bi t with servlets previously, you're probably used to invoki ng a servlet with a URI that 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 thi s convention today, even though it's not formally defined in the servlet specification.。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
毕业设计(论文)外文文献翻译文献、资料中文题目:JSP的技术发展历史文献、资料英文题目:the technique development historyof jsp文献、资料来源:文献、资料发表(出版)日期:院(部):专业:计算机班级:姓名:学号:指导教师:翻译日期: 2017.02.14THE TECHNIQUE DEVELOPMENT HISTORY OF JSPBy:Kathy Sierra and Bert BatesSource: Servlet&JSPThe Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system.The After Sun release the JS P( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product.This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP.1.1 GENER ALIZEThe JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it.JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not thepower of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose.JSP provides the following benefits over servlets alone:• It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax.• You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags.• You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content.Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the apGFDGpropriate tool for the job, and servlets, by themselves, do not complete your toolkit.1.2 SOURCE OF JSPThe technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of)The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web。