图书管理系统外文翻译(将Servlet和JSP组合使用)

合集下载

在线图书管理系统外文文献原文及译文

在线图书管理系统外文文献原文及译文

毕业设计说明书英文文献及中文翻译班姓 名:学 院:专指导教师:2014 年 6 月软件学院 软件工程An Introduction to JavaThe first release of Java in 1996 generated an incredible amount of excitement, not just in the computer press, but in mainstream media such as The New York Times, The Washington Post, and Business Week. Java has the distinction of being the first and only programming language that had a ten-minute story on National Public Radio. A $100,000,000 venture capital fund was set up solely for products produced by use of a specific computer language. It is rather amusing to revisit those heady times, and we give you a brief history of Java in this chapter.In the first edition of this book, we had this to write about Java: “As a computer language, Java’s hype is overdone: Java is certainly a good program-ming language. There is no doubt that it is one of the better languages available to serious programmers. We think it could potentially have been a great programming language, but it is probably too late for that. Once a language is out in the field, the ugly reality of compatibility with existing code sets in.”Our editor got a lot of flack for this paragraph from someone very high up at Sun Micro- systems who shall remain unnamed. But, in hindsight, our prognosis seems accurate. Java has a lot of nice language features—we examine them in detail later in this chapter. It has its share of warts, and newer additions to the language are not as elegant as the original ones because of the ugly reality of compatibility.But, as we already said in the first edition, Java was never just a language. There are lots of programming languages out there, and few of them make much of a splash. Java is a whole platform, with a huge library, containing lots of reusable code, and an execution environment that provides services such as security, portability across operating sys-tems, and automatic garbage collection.As a programmer, you will want a language with a pleasant syntax and comprehensible semantics (i.e., not C++). Java fits the bill, as do dozens of other fine languages. Some languages give you portability, garbage collection, and the like, but they don’t have much of a library, forcing you to roll your own if you want fancy graphics or network- ing or database access. Well, Java has everything—a good language, a high-quality exe- cution environment, and a vast library. That combination is what makes Java an irresistible proposition to so many programmers.SimpleWe wanted to build a system that could be programmed easily without a lot of eso- teric training and which leveraged t oday’s standard practice. So even though wefound that C++ was unsuitable, we designed Java as closely to C++ as possible in order to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more grief than benefit.The syntax for Java is, indeed, a cleaned-up version of the syntax for C++. There is no need for header files, pointer arithmetic (or even a pointer syntax), structures, unions, operator overloading, virtual base classes, and so on. (See the C++ notes interspersed throughout the text for more on the differences between Java and C++.) The designers did not, however, attempt to fix all of the clumsy features of C++. For example, the syn- tax of the switch statement is unchanged in Java. If you know C++, you will find the tran- sition to the Java syntax easy. If you are used to a visual programming environment (such as Visual Basic), you will not find Java simple. There is much strange syntax (though it does not take long to get the hang of it). More important, you must do a lot more programming in Java. The beauty of Visual Basic is that its visual design environment almost automatically pro- vides a lot of the infrastructure for an application. The equivalent functionality must be programmed manually, usually with a fair bit of code, in Java. There are, however, third-party development environments that provide “drag-and-drop”-style program development.Another aspect of being simple is being small. One of the goals of Java is to enable the construction of software that can run stand-alone in small machines. The size of the basic interpreter and class support is about 40K bytes; adding the basic stan- dard libraries and thread support (essentially a self-contained microkernel) adds an additional 175K.This was a great achievement at the time. Of course, the library has since grown to huge proportions. There is now a separate Java Micro Edition with a smaller library, suitable for embedded devices.Object OrientedSimply stated, object-oriented design is a technique for programming that focuses on the data (= objects) and on the interfaces to that object. To make an analogy with carpentry, an “object-oriented” carpenter would be mostly concerned with the chair he was building, and secondari ly with the tools used to make it; a “non-object- oriented” carpenter would think primarily of his tools. The object-oriented facilities of Java are essentially those of C++.Object orientation has proven its worth in the last 30 years, and it is inconceivable that a modern programming language would not use it. Indeed, the object-oriented features of Java are comparable to those of C++. The major difference between Java and C++ lies in multiple inheritance, which Java has replaced with the simpler concept of interfaces, and in the Java metaclass model (which we discuss in Chapter 5). NOTE: If you have no experience with object-oriented programming languages, you will want to carefully read Chapters 4 through 6. These chapters explain what object-oriented programming is and why it is more useful for programming sophisticated projects than are traditional, procedure-oriented languages like C or Basic.Network-SavvyJava has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the Net via URLs with the same ease as when accessing a local file system.We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tried to do Internet programming using another language will revel in how simple Java makes onerous tasks like opening a socket connection. (We cover net- working in V olume II of this book.) The remote method invocation mechanism enables communication between distributed objects (also covered in V olume II).RobustJava is intended for writing programs that must be reliable in a variety of ways.Java puts a lot of emphasis on early checking for possible problems, later dynamic (runtime) checking, and eliminating situations that are error-prone. The single biggest difference between Java and C/C++ is that Java has a pointer model that eliminates the possibility of overwriting memory and corrupting data.This feature is also very useful. The Java compiler detects many problems that, in other languages, would show up only at runtime. As for the second point, anyone who has spent hours chasing memory corruption caused by a pointer bug will be very happy with this feature of Java.If you are coming from a language like Visual Basic that doesn’t explicitly use pointers, you are probably wondering why this is so important. C programmers are not so lucky. They need pointers to access strings, arrays, objects, and even files. In Visual Basic, you do not use pointers for any of these entities, nor do you need to worry about memory allocation for them. On the other hand, many data structures are difficult to implementin a pointerless language. Java gives you the best of both worlds. You do not need point- ers for everyday constructs like strings and arrays. You have the power of pointers if you need it, for example, for linked lists. And you always have complete safety, because you can never access a bad pointer, make memory allocation errors, or have to protect against memory leaking away.Architecture NeutralThe compiler generates an architecture-neutral object file format—the compiled code is executable on many processors, given the presence of the Java runtime sys- tem. The Java compiler does this by generating bytecode instructions which have nothing to do with a particular computer architecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly.This is not a new idea. More than 30 years ago, both Niklaus Wirth’s original implemen- tation of Pascal and the UCSD Pascal system used the same technique.Of course, interpreting bytecodes is necessarily slower than running machine instruc- tions at full speed, so it isn’t clear that this is even a good idea. However, virtual machines have the option of translating the most frequently executed bytecode sequences into machine code, a process called just-in-time compilation. This strategy has proven so effective that even Microsoft’s .NET platform relies on a virt ual machine.The virtual machine has other advantages. It increases security because the virtual machine can check the behavior of instruction sequences. Some programs even produce bytecodes on the fly, dynamically enhancing the capabilities of a running program.PortableUnlike C and C++, there are no “implementation-dependent” aspects of the specifi- cation. The sizes of the primitive data types are specified, as is the behavior of arith- metic on them.For example, an int in Java is always a 32-bit integer. In C/C++, int can mean a 16-bit integer, a 32-bit integer, or any other size that the compiler vendor likes. The only restriction is that the int type must have at least as many bytes as a short int and cannot have more bytes than a long int. Having a fixed size for number types eliminates a major porting headache. Binary data is stored and transmitted in a fixed format, eliminating confusion about byte ordering. Strings are saved in a standard Unicode format. The libraries that are a part of the system define portable interfaces. For example,there is an abstract Window class and implementations of it for UNIX, Windows, and the Macintosh.As anyone who has ever tried knows, it is an effort of heroic proportions to write a pro- gram that looks good on Windows, the Macintosh, and ten flavors of UNIX. Java 1.0 made the heroic effort, delivering a simple toolkit that mapped common user interface elements to a number of platforms. Unfortunately, the result was a library that, with a lot of work, could give barely acceptable results on different systems. (And there were often different bugs on the different platform graphics implementations.) But it was a start. There are many applications in which portability is more important than user interface slickness, and these applications did benefit from early versions of Java. By now, the user interface toolkit has been completely rewritten so that it no longer relies on the host user interface. The result is far more consistent and, we think, more attrac- tive than in earlier versions of Java.InterpretedThe Java interpreter can execute Java bytecodes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory.Incremental linking has advantages, but its benefit for the development process is clearly overstated. Early Java development tools were, in fact, quite slow. Today, the bytecodes are translated into machine code by the just-in-time compiler.MultithreadedThe benefits of multithreading are better interactive responsiveness and real-time behavior.If you have ever tried to do multithreading in another language, you will be pleasantly surprised at how easy it is in Java. Threads in Java also can take advantage of multi- processor systems if the base operating system does so. On the downside, thread imple- mentations on the major platforms differ widely, and Java makes no effort to be platform independent in this regard. Only the code for calling multithreading remains the same across machines; Java offloads the implementation of multithreading to the underlying operating system or a thread library. Nonetheless, the ease of multithread- ing is one of the main reasons why Java is such an appealing language for server-side development.Java程序设计概述1996年Java第一次发布就引起了人们的极大兴趣。

计算机相关外文翻译3

计算机相关外文翻译3

With the popularity of the Inter NET applications, a variety of Web Information SystemHas become a pressing issue. Establish the essence of Web information systemsDevelopment of a Web repository (database as the core of a variety of Web letterInformation storage) as the core Web applications. Currently, the Web repositorydevelopment technologyOperation of a wide range of different characteristics. Various periods at all levels, a variety of purposesTechnology co-exist, dizzying mirror chaos, it is difficult to choose. More popularJava of Ser vet Web repository development program a more practicalOf choice.Servlet is running the applet on the Web server, can be completed XuMulti-client Applet can not complete the work, which runs on the server and clientsNo end, do not download do not by the client security restrictions, the running speedGreatly increasedAnd Applet running in a browser and extend the browser's ability similarLike, Serv the let run in the Web server to enable Java Serv the let engineAnd expand the capacity of the server. Therefore, we can say Serv the let is run inApplet on a Web server, Serv the let Jav a Servlet APIAnd Jav a program of classes and packages.1Servlet access model2Serv the let, there are three access models:(1) an access model1 browser to Web server to issue a retrieval request.2 the Web server after receipt of the request, the request forwarded tothe Servletengine.3 Serlet engine to perform the requested the Servlet and directly through JDBC4Servlet throughJDBC toretrieve search results to generate the html page and Page back to the Web server.5 the Web server the page is sent back to the browser.(2)The second access model1 browser to Web server to issue a retrieval request.2 the Web server receives the request after the request forwarded to the ofSer v the letengine.3Serv let engine to perform the request the the Servlet and retrieve sentJa, vabean access to the data.4data access the Javabean searchable database through JDBC informationAnd from the search results stored in itself.5Servlet remove search results from the data access Javabean generateHtml page and Ht ml of page back to the w eb server.6 the Web server the page is sent back to the browser.(3) The third access model1 A browser issue a retrieval request to the Web server.2 Web server receives the request after the request forwarded to the of Ser v thelet engine.Of Ser vlet engine to perform the requested Servlet directly through JDBC inspection 3 The cable database and search results are stored in the result isstored the Javabean into.Javabean,4. Ser v the let from the results are stored to remove the search results andJSP files to format the output page.2 Servlet functionality and life cycle2.1Servlet functions(1) Create and return dynamic Web pages based on customer requests.(2) create can be embedded into existing HTML pages as part of HTMLPage (HT fragment) of the ML.(3) and other server resources (including databases and applications based on the Jav a Program) to communicate.(4) to handle multiple client connections, receiving the input of more than one client, andThe results broadcast to multiple clients. For example, Ser vlet is a multi-participantGame server.(5) of MIM E type filter information on the special handling, such as imageConversion and server-side include (SSI).(6) custom processing available to all servers in the standard routine.2.2Servlet lifecycleServlet life cycle begins with it into the Web server's memoryAnd end in the termination or re-loaded Serv the let.(1)load.Load the servlet at the following times:1.If you have configured automatic load option, and then start the Webserver automatically loaded2.After the start of the Web server, the client Serv the let issued for the first time, pleaseDemand.3.Reload Serv the let.Loaded Servlet, Web servers to create a servlet instance, andServlet's init () method is called. Servlet initialization parameters in the initialization phase,The number is passed to the Servlet configuration object.(2)terminateWhen the Web server no longer needs the servlet, or reload ServletA new instance of the server calls Serv the let's destroy () method, remove it from the Memory deleted.3 How to call ServletMethod of Ser vlet is called Total five kinds: call in the URL in the form<Form> Tag call, call, in HT the ML page in the JSP filesCall, call in an ASP file. The following itemized to be introduced.(1)call the servlet in the URL.Simply input format in the browser as http: ∥yourwebserverthe same the ser vlet name name / servlet path / servlet the URL toThe site canbe. Ofwhich:yourwebserver name is to refer to the Servlet where theWeb server name, the servlet path is the path refers to the Servlet, the servletThe name refers to the Servlet real name or an alias.(2)call the Servlet <FORM> tagsCall of Ser the let the the <FORM> tag allows users to input data on the Web page, andinput data submitted to the vlet of Ser.Serv the let will be submitted to receive data in different ways.For example: <FORM METHOD = "POST / a GET" the ACTION = "/ servletpat h / serv let name"> {place the text input area tags, buttons and other logos}(3)in the HTML page to call the servlet.Use <SERVLET> mark <FORM> tags, no need to create a complete HTML page.Instead,the servlet output isonly part of the HTMLpage (HTML fragment) and d ynamicallyembedded into the static text in the original HTML page.All this happened on the server andsent to the user only the resulting HTML page.<SERVLET> </ SERVLET> tag contained in the original HTML page.Servlet will be invoked in these two markers and the Servlet response will cover these two markersbetween all things and mark itself, for example:〈SERVLET NAME= “my serv let ”CODE= “my serv let .class”CODEBASE= “u r l”initpar am= “v alue”〉〈PARAM NAME= “parm1”VALU E= “v alue1”〉〈PARAM NAME= “parm2”VALU E= “v alue2”〉⋯⋯〈/SERVLET 〉(4)call the servlet in the JSP files.Call in the JSP file format used by the Servlet and HTML page to call exactly the same.Andthe principles are identical. Only reconcile its dynamic JSP file is nota static HTML page.(5)in an ASP file calls the servlet.If you Micr oso ft I nt ernet Informatio n-Ser ver (II S) on the legacy of the ASP file, and can not be ASP files transplanted into a JSP file, you can use the ASP file to of Ser vlet iscalled.But it must be through a special ActiveX control, an ASP file is only through it can callthe servlet.4Servlet Howto use ConnectionManager toefficiently manage the database connection(1)the functionality of the Connection Manager.For non-Web applications, Web-based application access to the database will lead tohigher and unpredictable overhead, which is due to more frequent Webusers connect anddisconnect.Normally connected to the resources used and disconnect from the databasewill far exceed the resources used in the retrieval.Connection Manager function is to minimize the additional occupancy of the usersof the database resources to achieve thebest performance of database access. Connection Manager sharing overhead through the establishment of the connection poolwill connect users Servlet available to multiple users request.In other words, each userrequest only the connect / disconnect with a smallportion of the overhead costs.Initialresources toestablish the connection of the buffer pool, the rest of the connect/ disconnectoverhead is not big, because this is only reuse the existing connection. Serv the let in the following manner using the connection pool: When a user through Request Web Serv the let the let Serv use an existing connection from the buffer pool Next, this means that the user requests do not cause the connection to the databasesystem overhead. InAfter the termination of serv the let it connect to return to the pool for its Connection ManagerThe Servlet. Thus, the user request does not cause the database is disconnectedOf system overhead.Connection Manager also allows users to be able tocontrol the concurrency of thedatabase products evenThen the number. When the database license agreement limit the number of users, this feature isVery useful. Create a buffer pool for the database, and connection management Buffering pool "maximum number of connections" parameter setto the database product license limitGiven maximum number of users. If you use other programs without Connection ManagerconnectionsDatabase, you can not guarantee that the method is effective.(2)the structure of the Connection Manager.(3)Connection Manager connection pool to maintain a connection to a specificdatabase is open. Step 1: When the first Serv the let trying to Connection Manager communications is loaded by the Java Application Server ConnectionManager. As long as the Java application server running the Connection Manager has been loaded. Step 2: The Java application server passes the request to aservlet. Step 3: Servlet Connection Manager requests a connection from thepool. Step four: the buffer pool to Servlet allocated a pool of existing idleconnection. Step 5: servlet to use to connect a direct dialogue with the database, this process is the standard API for a particular database. Step 6: the databasethrough Servlet the connection returns data. Step 7: When the Servlet end tocommunicate with the database, servlet connections returned to the connection manager pool for other servlet uses. Step 8: Servlet Java application server to the user sends back response.Servlet requests a connection, if the buffer pool, there is no idle connection, then the connection manager directly communicate with the database. Connection Manager will: Step 9: to the database requests a new connection. Step 10: Add connections to the buffer pool. If the buffer pool is connected to the prescribed ceiling, connect to the serverWill not be a new connection to join the buffer pool(3) the performance characteristics of the Connection Manager.Buffer pool to create a new connection is a high overhead tasks, new connections will use the resources on the database. Therefore, the Connection Manager the best use of existing connections of the buffer pool to meet the request of the Servlet. Meanwhile, the connecting tubeThe processor must be as much as possible to minimize the buffer pool idle connections, because this is a great waste of system resources. Connection Manager Serv the let with the implementation of these minimize and maximize task. Connection Manager to maintain each connection verification time stamp, and recently used tags and use the logo. When the a Servlet first the connection, connection verification time stamp, and most recent time stamp is set to the current time, the connection is being used flag is set to true.Connection Manager can be removed from a Serv the let a long-unused connections, this length of time specified by the Connection Manager, the longest cycle parameters.Connection Manager can view recently used mark is being used to connect. If the time between the most recently used time and time difference is greater than the longest cycle configuration parameters, the connection will be considered to be a residual connection, which indicates Serv the let take its discontinued or no response. Residual connection will be returned to the pool for other Servlet, it is being used flag is set to false, authentication and time stamp is set to the current time.If Servlet is ready within a longer period of time to use the connection with the database several timesCommunications, you must code to the Serv the let, so that each time you use to connectConfirm that it still occupies this connection.Connection Manager can be removed from the buffer pool idle connections, because theyWould be a waste of resources. In order to determine which connection is idle, Connection Manager will checkInvestigation connected the sign and time stamp, this operation is connected by periodic access toBuffer pool information. Connection Manager checks have not been any Servlet makeWith the connections (these connections is to use the logo is false). If you have recently usedBetween time and the current time difference exceeds a maximum idle timeconfiguration parameters, theThat the connection is idle. Idle connection will be removed from the buffer pool, down toMinimum number of connections configuration parameter specifies the lower limit value.翻译:随着Inter net 的普及应用, 各种Web 信息系统的建立已成为一个迫在眉睫的问题。

Spring相关的外文文献和翻译(毕设论文必备)

Spring相关的外文文献和翻译(毕设论文必备)

附录1 外文原文Introducing the Spring FrameworkThe Spring Framework: a popular open source application framework that addresses many of the issues outlined in this book. This chapter will introduce the basic ideas of Spring and dis-cuss the central “bean factory”lightweight Inversion-of-Control (IoC) container in detail.Spring makes it particularly easy to implement lightweight, yet extensible, J2EE archi-tectures. It provides an out-of-the-box implementation of the fundamental architectural building blocks we recommend. Spring provides a consistent way of structuring your applications, and provides numerous middle tier features that can make J2EE development significantly easier and more flexible than in traditional approaches.The basic motivations for Spring are:To address areas not well served by other frameworks. There are numerous good solutions to specific areas of J2EE infrastructure: web frameworks, persistence solutions, remoting tools, and so on. However, integrating these tools into a comprehensive architecture can involve significant effort, and can become a burden. Spring aims to provide an end-to-end solution, integrating spe-cialized frameworks into a coherent overall infrastructure. Spring also addresses some areas that other frameworks don’t. For example, few frameworks address generic transaction management, data access object implementation, and gluing all those things together into an application, while still allowing for best-of-breed choice in each area. Hence we term Spring an application framework, rather than a web framework, IoC or AOP framework, or even middle tier framework.To allow for easy adoption. A framework should be cleanly layered, allowing the use of indi-vidual features without imposing a whole world view on the application. Many Spring features, such as the JDBC abstraction layer or Hibernate integration, can be used in a library style or as part of the Spring end-to-end solution.To deliver ease of use. As we’ve noted, J2EE out of the box is relatively hard to use to solve many common problems. A good infrastructure framework should make simple tasks simple to achieve, without forcing tradeoffs for future complex requirements (like distributed transactions) on the application developer. It should allow developers to leverage J2EE services such as JTA where appropriate, but to avoid dependence on them in cases when they are unnecessarily complex.To make it easier to apply best practices. Spring aims to reduce the cost of adhering to best practices such as programming to interfaces, rather than classes, almost to zero. However, it leaves the choice of architectural style to the developer.Non-invasiveness. Application objects should have minimal dependence on the framework. If leveraging a specific Spring feature, an object should depend only on that particular feature, whether by implementing a callback interface or using the framework as a class library. IoC and AOP are the key enabling technologies for avoiding framework dependence.Consistent configuration. A good infrastructure framework should keep application configuration flexible and consistent, avoiding the need for custom singletons and factories. A single style should be applicable to all configuration needs, from the middle tier to web controllers.Ease of testing. Testing either whole applications or individual application classes in unit tests should be as easy as possible. Replacing resources or application objects with mock objects should be straightforward.To allow for extensibility. Because Spring is itself based on interfaces, rather than classes, it is easy to extend or customize it. Many Spring components use strategy interfaces, allowing easy customization.A Layered Application FrameworkChapter 6 introduced the Spring Framework as a lightweight container, competing with IoC containers such as PicoContainer. While the Spring lightweight container for JavaBeans is a core concept, this is just the foundation for a solution forall middleware layers.Basic Building Blockspring is a full-featured application framework that can be leveraged at many levels. It consists of multi-ple sub-frameworks that are fairly independent but still integrate closely into a one-stop shop, if desired. The key areas are:Bean factory. The Spring lightweight IoC container, capable of configuring and wiring up Java-Beans and most plain Java objects, removing the need for custom singletons and ad hoc configura-tion. Various out-of-the-box implementations include an XML-based bean factory. The lightweight IoC container and its Dependency Injection capabilities will be the main focus of this chapter.Application context. A Spring application context extends the bean factory concept by adding support for message sources and resource loading, and providing hooks into existing environ-ments. Various out-of-the-box implementations include standalone application contexts and an XML-based web application context.AOP framework. The Spring AOP framework provides AOP support for method interception on any class managed by a Spring lightweight container. It supports easy proxying of beans in a bean factory, seamlessly weaving in interceptors and other advice at runtime. Chapter 8 dis-cusses the Spring AOP framework in detail. The main use of the Spring AOP framework is to provide declarative enterprise services for POJOs.Auto-proxying. Spring provides a higher level of abstraction over the AOP framework and low-level services, which offers similar ease-of-use to .NET within a J2EE context. In particular, the provision of declarative enterprise services can be driven by source-level metadata.Transaction management. Spring provides a generic transaction management infrastructure, with pluggable transaction strategies (such as JTA and JDBC) and various means for demarcat-ing transactions in applications. Chapter 9 discusses its rationale and the power and flexibility that it offers.DAO abstraction. Spring defines a set of generic data access exceptions that canbe used for cre-ating generic DAO interfaces that throw meaningful exceptions independent of the underlying persistence mechanism. Chapter 10 illustrates the Spring support for DAOs in more detail, examining JDBC, JDO, and Hibernate as implementation strategies.JDBC support. Spring offers two levels of JDBC abstraction that significantly ease the effort of writing JDBC-based DAOs: the org.springframework.jdbc.core package (a template/callback approach) and the org.springframework.jdbc.object package (modeling RDBMS operations as reusable objects). Using the Spring JDBC packages can deliver much greater pro-ductivity and eliminate the potential for common errors such as leaked connections, compared with direct use of JDBC. The Spring JDBC abstraction integrates with the transaction and DAO abstractions.Integration with O/R mapping tools. Spring provides support classes for O/R Mapping tools like Hibernate, JDO, and iBATIS Database Layer to simplify resource setup, acquisition, and release, and to integrate with the overall transaction and DAO abstractions. These integration packages allow applications to dispense with custom ThreadLocal sessions and native transac-tion handling, regardless of the underlyingO/R mapping approach they work with.Web MVC framework. Spring provides a clean implementation of web MVC, consistent with the JavaBean configuration approach. The Spring web framework enables web controllers to be configured within an IoC container, eliminating the need to write any custom code to access business layer services. It provides a generic DispatcherServlet and out-of-the-box controller classes for command and form handling. Request-to-controller mapping, view resolution, locale resolution and other important services are all pluggable, making the framework highly extensi-ble. The web framework is designed to work not only with JSP, but with any view technology, such as Velocity—without the need for additional bridges. Chapter 13 discusses web tier design and the Spring web MVC framework in detail.Remoting support. Spring provides a thin abstraction layer for accessing remoteservices without hard-coded lookups, and for exposing Spring-managed application beans as remote services. Out-of-the-box support is included for RMI, Caucho’s Hessian and Burlap web service protocols, and WSDL Web Services via JAX-RPC. Chapter 11 discusses lightweight remoting.While Spring addresses areas as diverse as transaction management and web MVC, it uses a consistent approach everywhere. Once you have learned the basic configuration style, you will be able to apply it in many areas. Resources, middle tier objects, and web components are all set up using the same bean configuration mechanism. You can combine your entire configuration in one single bean definition file or split it by application modules or layers; the choice is up to you as the application developer. There is no need for diverse configuration files in a variety of formats, spread out across the application.Spring on J2EEAlthough many parts of Spring can be used in any kind of Java environment, it is primarily a J2EE application framework. For example, there are convenience classes for linking JNDI resources into a bean factory, such as JDBC DataSources and EJBs, and integration with JTA for distributed transaction management. In most cases, application objects do not need to work with J2EE APIs directly, improving reusability and meaning that there is no need to write verbose, hard-to-test, JNDI lookups.Thus Spring allows application code to seamlessly integrate into a J2EE environment without being unnecessarily tied to it. You can build upon J2EE services where it makes sense for your application, and choose lighter-weight solutions if there are no complex requirements. For example, you need to use JTA as transaction strategy only if you face distributed transaction requirements. For a single database, there are alternative strategies that do not depend on a J2EE container. Switching between those transac-tion strategies is merely a matter of configuration; Spring’s consistent abstraction avoids any need to change application code.Spring offers support for accessing EJBs. This is an important feature (andrelevant even in a book on “J2EE without EJB”) because the use of dynamic proxies as codeless client-side business delegates means that Spring can make using a local stateless session EJB an implementation-level, rather than a fundamen-tal architectural, choice. Thus if you want to use EJB, you can within a consistent architecture; however, you do not need to make EJB the cornerstone of your architecture. This Spring feature can make devel-oping EJB applications significantly faster, because there is no need to write custom code in service loca-tors or business delegates. Testing EJB client code is also much easier, because it only depends on the EJB’s Business Methods interface (which is not EJB-specific), not on JNDI or the EJB API.Spring also provides support for implementing EJBs, in the form of convenience superclasses for EJB implementation classes, which load a Spring lightweight container based on an environment variable specified in the ejb-jar.xml deployment descriptor. This is a powerful and convenient way of imple-menting SLSBs or MDBs that are facades for fine-grained POJOs: a best practice if you do choose to implement an EJB application. Using this Spring feature does not conflict with EJB in any way—it merely simplifies following good practice.Introducing the Spring FrameworkThe main aim of Spring is to make J2EE easier to use and promote good programming practice. It does not reinvent the wheel; thus you’ll find no logging packages in Spring, no connection pools, no distributed transaction coordinator. All these features are provided by other open source projects—such as Jakarta Commons Logging (which Spring uses for all its log output), Jakarta Commons DBCP (which can be used as local DataSource), and ObjectWeb JOTM (which can be used as transaction manager)—or by your J2EE application server. For the same reason, Spring doesn’t provide an O/R mapping layer: There are good solutions for this problem area, such as Hibernate and JDO.Spring does aim to make existing technologies easier to use. For example, although Spring is not in the business of low-level transaction coordination, it does provide an abstraction layer over JTA or any other transaction strategy. Spring is alsopopular as middle tier infrastructure for Hibernate, because it provides solutions to many common issues like SessionFactory setup, ThreadLocal sessions, and exception handling. With the Spring HibernateTemplate class, implementation methods of Hibernate DAOs can be reduced to one-liners while properly participating in transactions.The Spring Framework does not aim to replace J2EE middle tier services as a whole. It is an application framework that makes accessing low-level J2EE container ser-vices easier. Furthermore, it offers lightweight alternatives for certain J2EE services in some scenarios, such as a JDBC-based transaction strategy instead of JTA when just working with a single database. Essentially, Spring enables you to write appli-cations that scale down as well as up.Spring for Web ApplicationsA typical usage of Spring in a J2EE environment is to serve as backbone for the logical middle tier of a J2EE web application. Spring provides a web application context concept, a powerful lightweight IoC container that seamlessly adapts to a web environment: It can be accessed from any kind of web tier, whether Struts, WebWork, Tapestry, JSF, Spring web MVC, or a custom solution.The following code shows a typical example of such a web application context. In a typical Spring web app, an applicationContext.xml file will reside in theWEB-INF directory, containing bean defini-tions according to the “spring-beans”DTD. In such a bean definition XML file, business objects and resources are defined, for example, a “myDataSource”bean, a “myInventoryManager”bean, and a “myProductManager”bean. Spring takes care of their configuration, their wiring up, and their lifecycle.<beans><bean id=”myDataSource”class=”org.springframework.jdbc. datasource.DriverManagerDataSource”><property name=”driverClassName”> <value>com.mysql.jdbc.Driver</value></property> <property name=”url”><value>jdbc:mysql:myds</value></property></bean><bean id=”myInventoryManager”class=”ebusiness.DefaultInventoryManager”> <property name=”dataSource”><ref bean=”myDataSource”/> </property></bean><bean id=”myProductManager”class=”ebusiness.DefaultProductManager”><property name=”inventoryManager”><ref bean=”myInventoryManager”/> </property><property name=”retrieveCurrentStock”> <value>true</value></property></bean></beans>By default, all such beans have “singleton”scope: one instance per context. The “myInventoryManager”bean will automatically be wired up with the defined DataSource, while “myProductManager”will in turn receive a reference to the “myInventoryManager”bean. Those objects (traditionally called “beans”in Spring terminology) need to expose only the corresponding bean properties or constructor arguments (as you’ll see later in this chapter); they do not have to perform any custom lookups.A root web application context will be loaded by a ContextLoaderListener that is defined in web.xml as follows:<web-app><listener> <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class></listener>...</web-app>After initialization of the web app, the root web application context will beavailable as a ServletContext attribute to the whole web application, in the usual manner. It can be retrieved from there easily via fetching the corresponding attribute, or via a convenience method in org.springframework.web.context.support.WebApplicationContextUtils. This means that the application context will be available in any web resource with access to the ServletContext, like a Servlet, Filter, JSP, or Struts Action, as follows:WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);The Spring web MVC framework allows web controllers to be defined as JavaBeans in child application contexts, one per dispatcher servlet. Such controllers can express dependencies on beans in the root application context via simple bean references. Therefore, typical Spring web MVC applications never need to perform a manual lookup of an application context or bean factory, or do any other form of lookup.Neither do other client objects that are managed by an application context themselves: They can receive collaborating objects as bean references.The Core Bean FactoryIn the previous section, we have seen a typical usage of the Spring IoC container in a web environment: The provided convenience classes allow for seamless integration without having to worry about low-level container details. Nevertheless, it does help to look at the inner workings to understand how Spring manages the container. Therefore, we will now look at the Spring bean container in more detail, starting at the lowest building block: the bean factory. Later, we’ll continue with resource setup and details on the application context concept.One of the main incentives for a lightweight container is to dispense with the multitude of custom facto-ries and singletons often found in J2EE applications. The Spring bean factory provides one consistent way to set up any number of application objects, whether coarse-grained components or fine-grained busi-ness objects. Applying reflection and Dependency Injection, the bean factory can host components that do not need to be aware of Spring at all. Hence we call Spring a non-invasiveapplication framework.Fundamental InterfacesThe fundamental lightweight container interface isorg.springframework.beans.factory.Bean Factory. This is a simple interface, which is easy to implement directly in the unlikely case that none of the implementations provided with Spring suffices. The BeanFactory interface offers two getBean() methods for looking up bean instances by String name, with the option to check for a required type (and throw an exception if there is a type mismatch).public interface BeanFactory {Object getBean(String name) throws BeansException;Object getBean(String name, Class requiredType) throws BeansException;boolean containsBean(String name);boolean isSingleton(String name) throws NoSuchBeanDefinitionException;String[] getAliases(String name) throws NoSuchBeanDefinitionException;}The isSingleton() method allows calling code to check whether the specified name represents a sin-gleton or prototype bean definition. In the case of a singleton bean, all calls to the getBean() method will return the same object instance. In the case of a prototype bean, each call to getBean() returns an inde-pendent object instance, configured identically.The getAliases() method will return alias names defined for the given bean name, if any. This mecha-nism is used to provide more descriptive alternative names for beans than are permitted in certain bean factory storage representations, such as XML id attributes.The methods in most BeanFactory implementations are aware of a hierarchy that the implementation may be part of. If a bean is not found in the current factory, the parent factory will be asked, up until the root factory. From the point of view of a caller, all factories in such a hierarchy will appear to be merged into one. Bean definitions in ancestor contexts are visible to descendant contexts, but not the reverse.All exceptions thrown by the BeanFactory interface and sub-interfaces extend org.springframework. beans.BeansException, and are unchecked. This reflects the fact that low-level configuration prob-lems are not usually recoverable: Hence, application developers can choose to write code to recover from such failures if they wish to, but should not be forced to write code in the majority of cases where config-uration failure is fatal.Most implementations of the BeanFactory interface do not merely provide a registry of objects by name; they provide rich support for configuring those objects using IoC. For example, they manage dependen-cies between managed objects, as well as simple properties. In the next section, we’ll look at how such configuration can be expressed in a simple and intuitive XML structure.The sub-interface org.springframework.beans.factory.ListableBeanFactory supports listing beans in a factory. It provides methods to retrieve the number of beans defined, the names of all beans, and the names of beans that are instances of a given type:public interface ListableBeanFactory extends BeanFactory {int getBeanDefinitionCount();String[] getBeanDefinitionNames();String[] getBeanDefinitionNames(Class type);boolean containsBeanDefinition(String name);Map getBeansOfType(Class type, boolean includePrototypes,boolean includeFactoryBeans) throws BeansException}The ability to obtain such information about the objects managed by a ListableBeanFactory can be used to implement objects that work with a set of other objects known only at runtime.In contrast to the BeanFactory interface, the methods in ListableBeanFactory apply to the current factory instance and do not take account of a hierarchy that the factory may be part of. The org.spring framework.beans.factory.BeanFactoryUtils class provides analogous methods that traverse an entire factory hierarchy.There are various ways to leverage a Spring bean factory, ranging from simple bean configuration to J2EE resource integration and AOP proxy generation. The bean factory is the central, consistent way of setting up any kind of application objects in Spring, whether DAOs, business objects, or web controllers. Note that application objects seldom need to work with the BeanFactory interface directly, but are usu-ally configured and wired by a factory without the need for any Spring-specific code.For standalone usage, the Spring distribution provides a tiny spring-core.jar file that can be embed-ded in any kind of application. Its only third-party dependency beyond J2SE 1.3 (plus JAXP for XML parsing) is the Jakarta Commons Logging API.The bean factory is the core of Spring and the foundation for many other services that the framework offers. Nevertheless, the bean factory can easily be usedstan-dalone if no other Spring services are required.附录2 中文译文Spring框架介绍Spring框架:这是一个流行的开源应用框架,它可以解决很多问题。

商城购物系统设计中英文对照外文翻译文献

商城购物系统设计中英文对照外文翻译文献

商城购物系统设计中英文对照外文翻译文献Abstract: Servlet programs run on the server side, ___ CGI-like technologies, Java Servlet has higher efficiency, easier to use, more powerful ns, better portability, and more cost savings.Keywords: ___, Servlet, HTTP service1.1 n of ServletServlets are Java programs that run on web or n servers. It is a middleware that connects requests from web browsers or other HTTP client programs and databases or ns on HTTP servers. The work of the servlet is to perform the tasks of the Simeon, as shown in Figure 1.1.Figure 1.1 The role of web middleware(1) Read explicit data ______ by end users in HTML forms on the page. However, data may also come from applets or custom HTTP client programs. (2) Read implicit request data sent by the browserFigure 1.1 shows a single arrow from the client to the web server, but in fact, there are two types of data transmitted from the client to the web server, which are explicit data entered by the user in the form and background HTTP n. Both types of data are important. HTTP n includes cookies, media types recognized by browsers, ___.(3) Generate resultsThis process may require accessing a database, performing RMI or EJB calls, calling web services, or directly calculating the corresponding response. The actual data may be stored in a nal database. The database may not understand HTTP or may not be able to return results in HTML form, so web browsers ___ with the database. Even if it can do this, for security reasons, we do not want it to do so. Similar ___, we need the web middleware to extract input data from the HTTP stream, communicate with the n, and embed the results into the document.(4) ___) to usersThis document can be sent in us formats, including text (HTML or XML), binary (GIF graphics), ___ underlying formats, such as gzip. However, HTML is the most commonly used formatso far, so one of the important tasks of Servlet and JSP is to wrap the results in HTML.(5) Send implicit HTTP response data to users总之,动态构建网页可以根据具体情况灵活地生成页面,从而满足客户的需求。

JAVA项目图书管理系统需求文档(基于JSP+SERVLET+JAVABEAN)

JAVA项目图书管理系统需求文档(基于JSP+SERVLET+JAVABEAN)

图书管理系统1、项目背景随着社会信息量的与日俱增,作为信息存储的主要媒体之一图书,数量、规模比以往任何时候都大的多,不论个人还是图书管理部门都需要使用方便而有效的方式来管理自己的书籍。

在计算机日益普及的今天,对个人而言若采用一套行之有效的图书管理系统来管理自己的书籍,会方便许多,这也充分应用硬件资源;对图书管理部门而言,以前单一的手工检索已不能满足人们的要求,为了便于图书资料的管理更为需要有效的图书管理软件。

图书管理系统软件LMS V1。

0是一功能比较完善的数据管理软件,具有数据操作方便高效迅速等优点。

该软件采用功能强大的数据库软件开发工具进行开发,具有很好的可移植性,可在应用范围较广的DOS,WINDOWS系列等操作系统上使用。

2、数据库设计设计思路图书管理系统设计的目的是为了让用户更方便的管理自己的书籍,可以根据自己的喜好查询某一类型的图书信息。

设计结果数据库名:bookmanagement以下是各个数据表的结构及说明用户表(bookusers)用户表是保存注册的用户信息,包括用户编号,账号,密码,姓名,注册时间用户(用户编号[主键],账号,密码,姓名,注册时间)3、系统功能设计作者的管理(增删改查)出版社的管理(增删改查)图书管理(增删改查)用户管理(增删改查)权限管理,管理员权限和普通用户权限(未实现)4、模块设计及功能各个用例模块流程如下:(1)登录界面用户在此登录,界面如下:登录之前点击作者管理等链接,提示未登录,登录之前做不了任何操作登录不成功界面登录成功(即进入作者版块)退出系统(2)从分类模块来看作者模块2、出版社模块3、图书模块4、用户模块5、图书查询模块(3)具体实现的功能每个页面的基本功能:实现增加、修改与删除(操作选项都有),显示(查询)还有每个页面都应该有分页的功能(出版社的分页效果)(图书的分页效果)添加/修改图书功能基础上的其他功能点击“验证ISBN是否重复”——弹出窗口提示:修改图书——ISBN不让修改(文本框成灰色)图书查询页面(以ISBN为例,其他字段相同)通过ISBN查询的结果没有查到结果————--—-—--。

超市管理系统的设计与实现论文外文翻译

超市管理系统的设计与实现论文外文翻译
2.Web开发中的问题
所有的Java开发都使用Servlet技术作为基础技术。同样的,所有的Java Web应用都有一些问题需要解决:
1.用户接口是在客户浏览器上呈现出的HTML标签。任何在应用中使用的服务器端组件都必须被编码成为正确的HTML标签。除了显示内容和数据外,用户接口还负责接收用户的输入。
另外,通过使用JavaBean和定制标签库,JSP能够将表示与业务逻辑相分离。 现今,基于JAVA的Web应用开发标准是将servlets与JSP结合在一起。随后,出现了许多种设计模型用来构建servlet/JSP应用:Model 1、Model 2、Struts]和JavaServer Faces(JSF)。Model 1和Model 2最早是在JSP规范中被提及的。Model 1只使用JSP而不使用servlet,Model 2则结合了JSP与servlet。Model 1和Model 2的使用是有条件的,Model 1适合与开发原型和非常小的应用,Model 2则是开发中型和大型应用推荐的设计模型。由于Model 2越来越被行业所接受,一个建立Struts框架的开源项目也因此被启动了。Struts通过为Model 2提供了模型-视图-控制器中的控制器来完善Model 2。另外,Struts提供了更好的页面导航管理机制和一些定制标签库,能够进行更快速的开发。尽管它学习难度大,并且,实际上它没有在任何的规范中被定义,但是它还是作为Model 2的一种替代获得了流行。JavaServer Faces是在JCP的JSR-127规范下被建立。Sun公司力推这项技术,希望它能够成为构建Java Web应用的最终模型。JSF最重要的特性是对ready-to-use组件的支持,比如:可扩展用户接口组件、简易的页面导航、输入验证、数据转换和JavaBean管理机制。servlet/JSP程序员面临的问题是选择最合适的设计模型。明显的,JSF在开发时间上提供了更好的解决方案。然而,有些人担心实施JSF的开销所带来的性能下降而不愿采用这种技术。

外文翻译---JSP的技术发展历史

外文翻译---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 web 外文翻译 外文文献

计算机 JSP web 外文翻译 外文文献

计算机 JSP web 外文翻译外文文献12.1 nEffective web n design involves separating business objects。

n。

and object XXX。

Although one individual may handle both roles on a small-scale project。

it is XXX.12.2 JSP ArchitectureIn this chapter。

XXX using JavaServer Pages。

servlets。

XXX of different architectures。

each building upon the us one。

The diagram below outlines this process。

and we will explain each component in detail later in this article.Note: XXX.)When Java Server Pages were introduced by Sun。

some people XXX。

While JSP is a key component of the J2EE n and serves as the preferred request handler and response mechanism。

it is XXX.XXX JSP。

the XXX that JSP is built on top of the servlet API and uses servlet XXX interesting ns。

such as whether we should XXX in our Web-enabled systems。

and if there is a way to combine servlets and JSPs。

外文文献—JSP的优势

外文文献—JSP的优势

附录I 英文翻译1、英文部分Benefits of JSPJSP 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 w ork 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 toolkitAdvantages of JSP Over Competing TechnologiesA 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, ColdFusion 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 thebandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did.So, the question becomes: why use JSP instead of one of these other technologies? Our first response is that we are not arguing that everyone should. Several of those other technologies are quite good and are reasonable options in some situations. In other situations, however, JSP is clearly better. Here are a few of the reasons.Versus .NET and Active Server Pages (ASP)NET is well-designed technology from Microsoft. is the part that directly competes with servlets and JSP. The advantages of JSP are twofoldFirst, JSP is portable to multiple operating systems and Web servers; you aren't locked into deploying on Windows and IIS. Although the core .NET platform runs on a few non-Windows platforms, the ASP part does not. You cannot expect to deploy serious applications on multiple servers and operating systems. For some applications, this difference does not matter. For others, it matters greatly.Second, for some applications the choice of the underlying language matters greatly. For example, although .NET's C# language is very well designed and is similar to Java, fewer programmers are familiar with either the core C# syntax or the many auxiliary libraries. In addition, many developers still use the original version of ASP. With this version, JSP has a clear advantage for the dynamic code. With JSP, the dynamic part is written in Java, not VBScript or another ASP-specific language, so JSP is more powerful and better suited to complex applications that require reusable componentsYou could make the same argument when comparing JSP to the previous version of ColdFusion; with JSP you can use Java for the "real code" and are not tied to a particular server product. However, the current release of ColdFusion is within the context of a J2EE server, allowing developers to easily mix ColdFusion and servlet/JSP code.Versus PHPPHP (a recursive acronym for "PHP: 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 PHP.Versus Pure ServletsJSP 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.Does this mean that you can just learn JSP and forget about servlets? Absolutely not! JSP developers need to 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 programming3. 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.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.Versus WebMacro or VelocityJSP 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 releasesHowever, 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.Besides, the tremendous industry support for JSP and servlet technology results in improvements that mitigate many of the criticisms of JSP. For example, the JSP Standard Tag Library and the JSP 2.0 expression language address two of the most well-founded criticisms: the lack of good iteration constructs and the difficulty of accessing dynamic results without using either explicit Java code or verbose jsp:useBean elementsForgetting JSP Is Server-Side TechnologyHere are some typical questions Marty has received (most of them repeatedly)• Our server is running JDK 1.4. So, how do I put a Swing component in a JSP page?• How do I put an image into a JSP page? I do not know the proper Java I/O commands to read image files• Since Tomcat does not support JavaScript, how do I make images that are highlighted when the user moves the mouse over them?• Our clients use older browsers that do not understand JSP. What should we do?• When our clients use "View Source" in a browser, how can I prevent them from seeing the JSP tags?All of these questions are based upon the assumption that browsers know something about the server-side process. But they do not. Thus:• For putting applets with Swing components into Web pages, what matters is the browser's Java version—the server's version is irrelevant. If the browser supports the Java 2 platform, you use the normal APPLET (or Java plug-in) tag and would do so even if you were using non-Java technology on the server.• You do not need Java I/O to read image files; you just put the i mage in the directory for Web resources (i.e., two levels up from WEB-INF/classes) and output a normal IMG tag • You create images that change under the mouse by using client-side JavaScript, referenced with the SCRIPT tag; this does not change just because the server is using JSP• Browsers do not "support" JSP at all—they merely see the output of the JSP page. So, make sure your JSP outputs HTML compatible with the browser, just as you would do with static HTML pages.• And, of course you need not do anyt hing to prevent clients from seeing JSP tags; those tags are processed on the server and are not part of the output that is sent to the client.Confusing Translation Time with Request TimeA JSP page is converted into a servlet. The servlet is compiled, loaded into the server's memory, initialized, and executed. But which step happens when? To answer that question, remember two points:• The JSP page is translated into a servlet and compiled only the first time it is accessed after having been modified.• L oading into memory, initialization, and execution follow the normal rules for servlets.2、中文部分:JSP的优势JSP页面最终会转换成servler。

外文翻译---J2EE WEB应用架构分析

外文翻译---J2EE WEB应用架构分析

附录附录一:文献资料原文J2EE WEB应用架构分析1、架构概述J2EE体系包括java server pages(JSP) ,java SERVLET, enterprise bean,WEB service等技术。

这些技术的出现给电子商务时代的WEB应用程序的开发提供了一个非常有竞争力的选择。

怎样把这些技术组合起来形成一个适应项目需要的稳定架构是项目开发过程中一个非常重要的步骤。

完成这个步骤可以形成一个主要里程碑基线。

形成这个基线有很多好处:各种因数初步确定:为了形成架构基线,架构设计师要对平台(体系)中的技术进行筛选,各种利弊的权衡。

往往架构设计师在这个过程中要阅读大量的技术资料,听取项目组成员的建议,考虑领域专家的需求,考虑赞助商成本(包括开发成本和运行维护成本)限额。

一旦架构设计经过评审,这些因数初步地就有了在整个项目过程中的对项目起多大作用的定位。

定向技术培训:一旦架构师设计的架构得到了批准形成了基线,项目开发和运行所采用的技术基本确定下来了。

众多的项目经理都会对预备项目组成员的技术功底感到担心;他们需要培训部门提供培训,但就架构师面对的技术海洋,项目经理根本就提不出明确的技术培训需求。

怎不能够对体系中所有技术都进行培训吧!有了架构里程碑基线,项目经理能确定这个项目开发会采用什么技术,这是提出培训需求应该是最精确的。

不过在实际项目开发中,技术培训可以在基线确定之前与架构设计并发进行。

角色分工:有了一个好的架构蓝图,我们就能准确划分工作。

如网页设计,JSP 标签处理类设计,SERVLET 设计,session bean设计,还有各种实现。

这些任务在架构蓝图上都可以清晰地标出位置,使得项目组成员能很好地定位自己的任务。

一个好的架构蓝图同时也能规范化任务,能很好地把任务划分为几类,在同一类中的任务的工作量和性质相同或相似。

这样工作量估计起来有一个非常好的基础。

运行维护:前面说过各个任务在架构图上都有比较好的定位。

餐饮管理系统中英文对照外文翻译文献

餐饮管理系统中英文对照外文翻译文献

餐饮管理系统中英文对照外文翻译文献(文档含英文原文和中文翻译)外文:A Comparative Study of Web Application Design ModelsUsing the Java TechnologiesAbstract.The Servlet technology has been the most widely used technology for building scalable Web applications. In the events, there are four design models for developing Web applications using the Java technologies: Model 1, Model2, Struts, and JavaServer Faces (JSF). Model 1 employs a series of JSP pages; Model 2 adopts the Model-View-Controller pattern; Struts is a framework employing the Model 2 design model; and JSF is a new technology that supports ready-to-use components for rapid Web application development. Model 1 is not recommended for medium-sized and large applications as it introduces maintenance nightmare. This paper compares and evaluates the ease of application development and the performance of the three design models (Model 2, Struts, and JSF) by buildingthree versions of an online store application using each of the three design models, respectively.1 IntroductionToday, Web applications are the most common applications for presenting dynamic contents. There are a number of technologies for building Web applications, the most popular of which is the Servlet technology . This technology gains its popularity from its superiority over other technologies such as CGI and PHP .Servlets are cumbersome to develop, however, because sending HTML tags requires the programmer to compose them into a String object and send this object to the browser. Also, a minor change to the output requires the servlet to be recompiled. To address this issue, Sun Microsystems invented JavaServer Pages (JSP) . JSP allows HTML tags to be intertwined with Java code and each page is translated into a servlet. A JSP page is a servlet. However, compilation occurs automatically when the page is first requested. As a result, changing the output does not need recompilation. In addition, JSP enables the separation of presentation from the business logic through the use of JavaBeans and custom tag libraries. The norm now in developing Javabased Web applications is to use servlets along with JavaServer Pages.In the later development, there are a number of design models for building servlet/JSP applications: Model 1, Model 2, Struts , and JSF . Model 1 and Model 2 were first mentioned in the early specifications of JSP. Model 1 strictly uses JSP pages, with no servlets, and Model 2 uses the combination of both servlets and JSP pages. The terms of Model 1 and Model 2 have been used ever since. Model 1 is suitable for prototypes and very small applications, and Model 2 is the recommended design model for medium sized and large applications.As Model 2 gained more acceptances in the industry, an open source initiative to build the Struts Framework was initiated. Struts perfects Model 2 by providing the controller part of the Model-View-Controller of Model 2. In addition, Struts provides better page navigation management and several custom tag libraries for more rapid development. Despite its steep learning curve and the fact that it was never defined in any specification, Struts has been gaining popularity as thealternative to Model 2.JavaServer Faces is built under the Java Community Process under JSR-127.Sun Microsystems proposed this technology in the hope that JSF will be the ultimate model for building Java Web applications. The most important feature of JSF is the availability of ready-to-use components such as extensible UI components, easy page navigation, input validators, data converters and JavaBeans management.The problem facing servlet/JSP programmers are to choose the most appropriate design model. Clearly, JSF provides a better solution in regard to development time. However, some people are not sanguine to adopt this technology for fear of performance penalty due to the overhead of the JSF implementation.We build three versions of an online store application named BuyDirect using Model 2, Struts and JSF. The parameters compared are the number of lines of code, the number of classes, and the performance measurement results. We investigate which of the design models allows the most rapid development process. We evaluate the performances of the applications built upon these models. We provide some suggestions to perfect the existing design models to make development more rapid.The rest of the paper is organised as follows. Section 2 discusses the issues in Web development. Section 3 explains how the three design models address these development issues. Section 4 provides the details of the hardware and software used in these experiments. Section 5 presents the experiment results and analysis. Section 6 reviews the related work. Section 7 concludes by offering some suggestions to improve the existing design models.2 Java Web Development IssuesAll Java Web development uses the Servlet technology as the underlying technology. As such, all Java Web applications have certain issues that need to be addressed:User Interface. The user interface is what the client browser renders as HTML tags. Any server-side component used in the application must be encoded intothe corresponding HTML elements. Besides for displaying the content and data, the user interface is also responsible in receiving input from the user.●Input Validation. User input needs to be validated. There are two types of inputvalidation, server-side and client-side. As the name implies, the server-side input validation is performed on the server after the input reaches the server.Client-side input validation is done on the browser, usually by using JavaScript or other scripting languages. The advantages of using client-side input validation are prompt response and reducing the server workload. The server-side input validation should always be performed regardless the presence of client-side validation because there is no guarantee the user browser's scripting feature is being on and malicious users can easily work around client-side validation.●Model Objects. Model objects in Java-based Web applications are in the formsof JavaBeans. Model objects make up the Model part of the MVC based design model. A model object can be used to bind a component value to be used at a later stage. In addition, it can encapsulate business logic required for processing.●Page Navigation. Almost all Web applications have multiple pages that the usercan navigate from one to another. All MVC-based design models use a servlet as the Controller part. This servlet also acts as the sole entry point to the application. Which page to be displayed after the current request is determined by the value of a specified request parameter. Managing page navigation is critically important.3 Web Application Design ModelsThe Model 2 design model is based on the Model-View-Controller (MVC) design pattern. As explained by Burbeck , there are three main modules in MVC, the Controller, the View, and the Model. The Controller acts as the central entry point to the application. All user interactions go through this controller. The View contains the presentation part of the application, and the Model stores data or encapsulates business logic of the application. In the later development, the Struts Framework provides a common framework to easily build Model 2 applications.Then, the last initiative is the JavaServer Faces, which also employs the MVC design pattern.In the following sections, we discuss these three design models and explain how each design model addresses the development issues specified in the previous section.3.1 Model 2A Java Web application that is based on the Model 2 design model has one servlet(called the Controller servlet) that serves as the Controller part. All requests are first handled by this servlet, which immediately dispatches the requests to the appropriate views using RequestDispatcher objects. Views in the Model 2 design model are represented by JSP pages. To store data, a Model 2 application uses JavaBeans, which are the Model part of the application. In addition to storing data, the JavaBeans also encapsulate business logic. Each HTTP request carries an action parameter that indicates which view to dispatch this request to. The programmer must code the HTML tags for user interface in all JSP pages in the application and write input validation code. In addition, the model objects are managed by individual JSP pages.3.2 StrutsThe Struts Framework is an improvement of the Model 2 design model. It provides a default Controller servlet so that the user does not have to write and compile one. Struts alleviates the task of page navigation by allowing navigation rules to be present in its application configuration file (an XML document). Changes to the navigation rules do not require recompilation of a Java servlet class. In addition to easier page navigation, Struts provides custom tag libraries that define tags representing HTML elements. One of these tags is used for error handling and Struts is therefore capable of displaying localized error messages in support for internationalization. Struts applications use JavaBeans as their models, just like the Model 2 design model. In addition, Struts programmers have to write their own input validation code.3.3 JSFJSF also employs a controller servlet that is called FacesServlet. This servlet is the only entry point to a JSF application. JSF also uses JSP pages as its views and JavaBeans as its model objects. Unlike Model 2 and Struts, however, JSF provides ready-to-use user interface components that can be written on JSP pages. Upon an invocation of a page of a JSF application, the FacesServlet constructs a component tree that represents the JSP page being requested. Some of the components can also trigger events, making JSF event-driven. For page navigation, JSF uses an approach similar to Struts, i.e., by allowing navigation rules to be defined in an application configuration file (again, an XML document).What distinguishes a JSF application from non-JSF servlet/JSP application is that JSF applications are event-driven. The user interface of a JSF application is one or many JSP pages that host Web components such as forms and input boxes. These components are represented by JSF custom tags and can hold data. A component can be nested inside another, and it is possible to draw a tree of components. Just as in normal servlet/JSP applications, you use JavaBeans to store the data the user entered.4 Function EnvironmentThe software and hardware details for our experiments are described below.4.1 The Servlet ContainerA Java Web application runs in a servlet container, which is the engine that processes the incoming HTTP requests for the resources in the application. For this research project, we use Tomcat, an open source servlet container from the Apache Software Foundation. The version we use is 6.0.Basically, a servlet container processes a servlet by performing the following tasks:- Creating the HttpRequest Object- Creating the HttpResponse Object- Calling the service method of the Servlet interface, passing the HttpRequest and HttpResponse objects.4.2 Testing ClientsFor performance testing, we emulate multiple users using JMeter 1.9 , also from the Apache Software Foundation. JMeter allows the user to choose the number of threads to perform testing. Each thread emulates a different user. JMeter also lets us choose how many times a test will be done. To test a Web application using JMeter, you direct requests to certain IP address, context path, and port number. You can also specify request parameters to be included in each HTTP request. As the output, JMeter notifies the response time of the server in milliseconds for a test. From the response time, we derive the number of hits/seconds the server is capable of serving.4.3 HardwareWe use different computers for running the applications and for testing, so as to obtain maximum performance measurement accuracy. The computer running the application is a XP machine having the following hardware specifications: Intel Core 1GHz CPU with 1G RAM. The computer running the testing clients is a Windows 2000 machine running JMeter. The computer has the following specifications: Intel Core 1GHz CPU with 1G RAM.5 ResultsWe obtain experimental results in two categories: the ease of development and performance. The ease of development category compares the number of classes and the number of lines of code. These numbers indicate how easy it is to develop an application by following a certain design model. An application with the fewer number of classes or the number of lines of code indicates that the application is relatively easier to build. The application with the more number of classes indicates that the application takes more time to develop.The performance measurement results are obtained by comparing two operations. The Search operation is the most common operation in such an application,and the Browse operation.5.1 Ease of Application DevelopmentAs Table 1 shows, it takes the most effort to implement the Model 2 design model. Using Struts alleviates the problem a bit, and the best saving in the development comes if one uses JSF.Table 1. The number of classes and the number of lines for the applications under studyThe Model 2 design model is characterised by the presence of a Controller servlet and a number of JavaBeans classes (as the Model) and JSP pages (as the Views). The Controller servlet is responsible for page navigation rules that employ a series of if statements. Model 2 application programmers must also code for the input validation that in this research is implemented inside a number of custom tag libraries. The other classes in the Model 2 design model are custom tag library and the tag library descriptors responsible for input validation and data display. In fact, input validation takes 590 lines of code, or almost 30% of the total amount of code.In the Struts application, the Controller servlet is provided by the framework, therefore a Struts programmer saves time for not having to write one. However, he/she still needs to write page navigation rules in the Application Configuration file, which is easier than writing a servlet because the Application Configuration file can be edited using a text editor and no compilation is necessary. Input validation must still be done manually, even though the Struts Framework provides an error handling mechanism. The number of classes and the number of lines of code for input validation are almost similar to the Model 2 application. In Struts, the other classes are Action classes to which the default Controller servlet dispatches requests.In JSF input validation comes free through the availability of validatorcomponent. As a result, a JSF application developer can skip this task. In addition, page navigation takes the same course as Struts, i.e. by utilising an Application Configuration file. The other classes in JSF are a ContextListener, an ActionListener, and a Database utility class.5.2 Performance MeasurementFor each operation, we measure the server response time (in milliseconds) for 1 to 10 concurrent users. The number of users is specified by setting the number of threads in Jmeter. Each test is conducted 10 times and the average is taken. Each operation is discussed further is the following sub-sections.5.2.1 Search OperationThe Search operation whose name or description matches the keyword. There is one SQL SELECT statement performed. Figure 2 compares the three versions of applications for the Search operation.Fig. 2. The performance comparison for the Search operation For the Model 2 application, the average server response time for one user is 173 ms and for 10 users is 919 ms. For the Struts application, these numbers are 189 ms and 900 ms, respectively. For the application built using JSF, the average server response time is 210 ms for one user and 932 ms for 10 users. The increase of the response time is proportional to the increase of the number of concurrent users, which means that the server is still able to cope with the load.The Model 2 application has the least overhead, therefore the averageperformance should be better than the Struts and JSF applications. However, the Struts application performs as well as the Model 2 application. This is because the server has enough memory to load all Struts libraries required to run Struts. Also, note that page navigation rules in Struts are loaded and stored in an object called ActionMapping. Therefore, given an action request parameter, the next page of navigation is obtained through a look-up. On the other hand, the Model 2 application uses a series of if statements to find the next page of navigation, given the action request parameter.The JSF application performs slightly worse than the other applications in almost all numbers of concurrent users. This could be due to the time taken by the JSF implementation to construct a component tree for each page requested. However, the difference in server response time between JSF and other applications is not that significant.5.2.2 Browse OperationThe Browse operation,like the Search operation, there is one SQL SELECT statement performed. Figure 3 gives the test results for this operation.Fig. 3. The performance comparison for the Browse operation On average, the Model 2 application performs the best because it has the least overhead. The average server response time is 111 ms for one user and 899 ms for 10 users. The Struts application has comparable performance, with one user average server response time of 180 ms and 10 user response time of 920 ms. The JSF lacks a bit behind the two applications with these numbers being 190 and 1009ms respectively. The increase of the server response time is proportional to the increase of the number of concurrent users, which means the server is able to serve those users well. The average performance measurement results of the Browse operation are very similar to the ones for the Search operation because the database operations of both operations are also similar.6 Related WorkCompare the performance of database-based Web applications using Java servlets, PHP version 3, and Common Gateway Interface (CGI). After a series of benchmark tests that performs data retrieval from a MySQL database, find that the solution of Java servlets with persistent database connection has the best performance. PHP3 using persistent database connections performs fairly well when compared to the CGI solution,also mention the advantages of using Java servlets. According to these authors. Java servlets are an excellent choice to meet the requirement of e-commerce (such as online shopping) applications and are able to handle client requests in a highly interactive mode.Comparing PHP 4, Java servlets, and Enterprise JavaBeans. Measure the performance of these three architectures using two applications. Study reveals that PHP4 is more efficient than Java servlets, and the EJBs perform even worse than servlets. However, note that servlets, being part of the Java solution, provides the flexibility of being able to be ported to another system with a different operating system.7 ConclusionWe find that it is most rapid to build Web applications using JSF. Model 2 applications are the least rapid but give the best performance. Struts applications sit in the middle of the other two design models in both comparisons.We make some suggestions that could improve the Servlets technology in general and enhance the performance of applications based on both design models. Struts. Struts is not based on any specification and there is no documentation that discusses its internal working. Therefore, it is hard to know what have been implemented and what could be improved.●The Servlets Technology. The Servlet 2.3 Specification does not define anycaching mechanism. There is no mention of caching in the upcoming Servlet2.4 Specification either. Despite the dynamic nature of the content of a Webapplication, some contents do not change very often. For example, the categories of products that a user can browse in an online store application probably only change once in a month. If those semi-static contents must be generated from the database every time they are requested, a lot of programming resources will be wasted. Servlet programmers get around the absence of caching by writing an object that caches certain content. However, since there is no standard for caching, many programmers write the same piece of code again and again.●Model 2.The main drawback is that the page navigation rules are hard-coded inthe Controller servlet. This means any minor change to the program flow will require the Controller servlet to be re-compiled. The solution to this problem is to provide a mapper that reads the page navigation rules when the application starts. The code could be conveniently written in the init method of the Controller servlet. This method is only executed once, i.e. the first time the servlet is loaded into memory. If the properties file needs to be re-read every time it changes, the programmer can check the timestamp of the properties file for each request, and compares it with the previous read of this file. If the timestamp is more current than the previous read, the mapper can be re-constructed. This feature can be enabled and disabled by using an initial parameter in the Context object. At the development phase, this feature should be enabled. At deployment, this feature should be off. The use of the properties file to store the page navigation rules also makes it possible to avoid a series of if statements in the Controller Servlet, which can be time-consuming for every request. Instead, a HashMap can be used, with action request parameters as keys and the next JSP pages as values. The other disadvantage of this design model is the absence of standard components for input validation and user interface. However, this has been solved in JSF.●JSF. JSF provides solutions to common problems in Web development, such aspage navigation management, UI components and input validators. However, because this technology is still very young, there are not too many UIcomponents available, forcing programmers to combine JSF with non-JSF servlets/JSP pages. JSF is event-driven. JSF programmers determine the behavior of a JSF application by writing event listeners, just like those listeners in a Swing application. In JSF version 1.0, there are currently two types of events that can be triggered: ActionEvent and ValueChangedEvent. However, this is good enough to provide sufficient level of interactivity between the application and its users. Adding more types of events will definitely make JSF more appealing.References[1].Cecchet, E., Chanda A., Elnikety S., Marguerite J., Zwaenepoel W.: Performance Comparison of Middleware Architectures for Generating Dynamic Web Content. Proceeding of the 4th International Middelware Conference, 2003.[2].Cecchet, E., Marguerite, J., and Zwaenepoel, W.: Performance and Scalability of EJB Applications. Proceedings of OOPSLA’02, 2002.基于Java技术的Web应用设计模型的比较研究摘要Servlet技术在建立可扩展性Web应用中是被应用最广泛的技术。

冠希哥图书管理系统外文翻译

冠希哥图书管理系统外文翻译

重庆三峡学院毕业设计(论文)外文资料翻译设计(论文)题目图书管理系统院系计算机科学与工程学院专业计算机科学与技术年级2009级1班学生学号**********学生姓名管金凤外文出处CHINA-USA Business ReviewCombining 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 / doPost / 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.After another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded directly call the Servlet. If you have already been modified, it will be once again the implementation of the above process, 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 therequest, 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 the servlet. 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 followingmethods 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're out 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 bodyand 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 new session 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 theappropriate 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 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 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 Servletover 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 processingrequests in a flexible manner.● A 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/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网上商城系统毕业设计答辩外文文献及译文

jsp网上商城系统毕业设计答辩外文文献及译文

毕业设计说明书英文文献及中文翻译学生姓名:学号:学院:专业:指导教师:Struts——an open-source MVC implementationBy: Malcolm Davis.Source: Struts--an open-source MVC implementation[J].IBM Systems JournalThis article introduces Struts, a Model-View-Controller implementation that uses servlets and JavaServer Pages (JSP) technology. Struts can help you control change in your Web project and promote specialization. Even if you never implement a system with Struts,you may get some ideas for your future servlets and JSP page implementation.IntroductionKids in grade school put HTML pages on the Internet. However, there is a monumental difference between a grade school page and a professionally developed Web site. The page designer (or HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility, image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java developers are more interested in creating agreat looking object interface than a user interface. Java Server Pages (JSP) technology provides the glue between the page designer and the Java developer.If you have worked on a large-scale Web application, you understand the term change.Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. Struts is an MVC implementation that uses Servlets 2.2 and JSP 1.1 tags, from the J2EE specifications, as part of the implementation. Y ou may never implement a system with Struts, but looking at Struts may give you some ideas on your future Servlets and JSP implementations.Model-View-Controller (MVC)JSP tags solved only part of our problem. We still have issues with validation, flow control, and updating the state of the application. This is where MVC comes to the rescue.MVC helps resolve some of the issues with the single module approach by dividing theproblem into three categories:• ModelThe model contains the core of the application's functionality. The model encapsulates thestate of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.• View• The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. ControllerThe controller reacts to the user input. It creates and sets the model.MVC Model 2The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to notify the view of changes. On the Web, the browser has to re-query the server to discover modification to the state of the application.Another noticeable change is that the view uses different technology for implementation than the model or controller. Of course, we could use Java (or PERL, C/C++ or what ever) code to generate HTML. There are several disadvantages to that approach:• Java programmers should develop services, not HTML.• Changes to layout would require changes to code.• Customers of the service should be able to create pages to meet their specific needs.• The page designer isn't able to have direct involvement in page development.• HTML embedded into code is ugly.For the Web, the classical form of MVC needed to change.MVC Model 2 Struts, an MVC 2 implementation Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. This definition implies that Struts is a framework, rather than a library, but Struts also contains an extensive tag library and utility classes that work independently of the framework.• Client browserAn HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.• ControllerThe Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.• Business logicThe business logic updates the state of the model and helps control the flow of the application.With Struts this is done with an Action class as a thin wrapper to the actual business logic.• Model stateThe model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags.• ViewThe view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like V elocity.Struts detailsDisplayed in Figure 6 is a stripped-down UML diagram of the org.apache.struts.action package and shows the minimal relationships among ActionServlet (Controller), ActionForm (Form State), and Action (Model Wrapper).The ActionServlet classDo you remember the days of function mappings? Y ou would map some input event to a ointer to a function. If you where slick, you would place the configuration information into ale and load the file at run time. Function pointer arrays were the good old days of structured rogramming in C.Life is better now that we have Java technology, XML, J2EE, and all that. The Struts ontroller is a servlet that maps events (an event generally being an HTTP post) to classes. guess what -- the Controller uses a configuration file so you don_t have to hard-code the alues. Life changes, but stays the same.ActionServlet is the Command part of the MVC implementation and is the core of the ramework. ActionServlet (Command) creates and uses Action, an ActionForm, and ctionForward. As mentioned earlier, the struts-config.xml file configures the command. uring the creation of the Web project, Action and ActionForm are extended to solve the pecific problem space. The file struts-config.xml instructs ActionServlet on how to use the xtended classes. There are several advantages to this approach:• The entire logical flow of the application is in a hierarchical text file. This makes itasier to view and understand, especially with large applications.• The page designer does not have to wade through Java code to understand the flow of e application.• The Java developer does not need to recompile code when making flow changes. Command functionality can be added by extending ActionServlet.The ActionForm classActionForm maintains the session state for the Web application. ActionForm is anbstract class that is sub-classed for each input form model. When I say input form model, Im saying ActionForm represents a general concept of data that is set or updated by a HTML form. For instance, you may have a UserActionForm that is set by an HTML Form. The Struts framework will:• Check to see if a UserActionForm exists; if not, it will create an instance of the class.• Struts will set the state of the UserActionForm using corresponding fields from the HttpServletRequest. No more dreadful request.getParameter() calls. For instance, the Struts framework will take fname from request stream and call UserActionForm.setFname().• The Struts framework updates the state of the UserActionForm before passing it to the business wrapper UserAction.• Before passing it to the Action class, Struts will also conduct form state validation by calling the validation() method on UserActionForm. Note: This is not always wise to do. There might be ways of using UserActionForm in other pages or business objects, where the validation might be different. V alidation of the state might be better in the UserAction class.• The UserActionForm can be maintained at a session level.Notes:• The struts-config.xml file controls which HTML form request maps to which ActionForm. • Multiple requests can be mapped UserActionForm.• UserActionForm can be mapped over multiple pages for things such as wizards.The Action classThe Action class is a wrapper around the business logic. The purpose of Action class is to translate the HttpServletRequest to the business logic. To use Action, subclass and overwrite the process() method.The ActionServlet (Command) passes the parameterized classes to ActionForm using the perform() method. Again, no more dreadful request.getParameter() calls. By the time the event gets here, the input form data (or HTML form data) has already been translated out of the request stream and into an ActionForm class.Note: "Think thin" when extending the Action class. The Action class should control the flow and not the logic of the application. By placing the business logic in a separate package or EJB, we allow flexibility and reuse.Another way of thinking about Action class is as the Adapter design pattern. The purpose of the Action is to "Convert the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn_t otherwise because of incompatibility interface" (from Design Patterns - Elements of Reusable OO Software by Gof). The client in this instance is the ActionServlet that knows nothing about our specific business class interface. Therefore, Struts provides a business interface it does understand, Action. By extending the Action, we make our business interface compatible with Struts business interface. (An interesting observation is that Action is a class and not an interface. Action started as an interface and changed into a class over time. Nothing's perfect.)The Error classesThe UML diagram (Figure 6) also included ActionError and ActionErrors. ActionError encapsulates an individual error message. ActionErrors is a container of ActionError classes that the View can access using tags. ActionErrors is Struts way of keeping up with a list of errors.UML diagram of the relationship of the Command (ActionServlet) to the Model (Action) The ActionMapping classAn incoming event is normally in the form of an HTTP request, which the servlet Container turns into an HttpServletRequest. The Controller looks at the incoming event and dispatches the request to an Action class. The struts-config.xml determines what Action class the Controller calls. The struts-config.xml configuration information is translated into a set of ActionMapping, which are put into container of ActionMappings. (If you have not noticed it, classes that end with s are containers) The ActionMapping contains the knowledge of how a specific event maps to specific Actions. The ActionServlet (Command) passes the ActionMapping to the Action class via the perform() method. This allows Action to access the information to control flow.ActionMappingsActionMappings is a collection of ActionMapping objects.Struts pros Use of JSP tag mechanism The tag feature promotes reusable code and abstracts Java code from the JSP file. This feature allows nice integration into JSP-based development tools that allow authoring with tags.• Tag libraryWhy re-invent the wheel, or a tag library? If you cannot find something you need in the library, contribute. In addition, Struts provides a starting point if you are learning JSP tag technology.• Open sourceY ou have all the advantages of open source, such as being able to see the code and having everyone else using the library reviewing the code. Many eyes make for great code review.• Sample MVC implementationStruts offers some insight if you want to create your own MVC implementation.• Manage the problem spaceDivide and conquer is a nice way of solving the problem and making the problem manageable.中北大学2014届毕业设计英文文献译文Struts 一个开源的MVC实现作者:马尔科姆·戴维斯。

订单管理系统中英文对照外文翻译文献

订单管理系统中英文对照外文翻译文献

中英文对照外文翻译(文档含英文原文和中文翻译)MySQL and JSP Web applicationsJSP developers encounter unique problems when building web applications that require intense database connectivity. MySQL and JSP Web Applications addresses the challenges of building data-driven applications based on the JavaServer Pages development model. MySQL and JSP Web Applications begins with an overview of the core technologies required for JSP database development--JavaServer Pages, JDBC, and the database schema. The book then outlines and presents an Internet commerce application that demonstrates concepts such as receiving and processing user input, designing and implementing business rules, and balancing the user load on the server. Through the JDBC (Java DataBase Connector), the developer can communicate with most commercial databases, such as Oracle. The solutions presented in MySQL and JSP Web Applications center on the open source tools MySQL and Tomcat, allowing the reader an affordable way to test applications and experiment with the book'sexamples.So What Is JSP All About?If you meet the requirements mentioned, you should already have a pretty good idea what the answer to this question is. JSP is all about doing highly object-oriented Web sites that can leverage all the best practices of modern software engineering. These practices include things such as SQL databases and UML-based design. This isn't to say that JSP is a cure-all and that using it will automatically make your Web site a paragon of engineering art. It's just as possible to design bad Web sites in JSP as with any other technology. That's why, as you go through the text, you will see how to incorporate the best practices and how to avoid the pitfalls of convenience when projects get stressful. JSP itself is an evolutionary step along the path that started with the first static Web servers, moved through CGI-enabled servers, and finally the first generation of script-enabled servers. JSP is less a Web server with a Java component than it is a Java engine that understands the Web.JSP grew out of Java servlets. Servlets allow the developer to handle the incoming Web requests using a Java program that has access to all the normal information that a Common Gateway Interface (CGI) program would. In addition, the servlet has access to session-persistent objects. These are Java objects that are associated with a specific user session and can be used to store state between requests. Servlet programming was a major step forward in allowing developers to write well-structured modular Web applications using an object-oriented language. It also solved the problem of state persistence, allowing more information to reside on the server during a transaction and less to have to pass back and forth between the user and the server. Servlets still suffered from one major problem. Because they eventually need to spit out HTML, the HTML coding had to be embedded in the servlet code. This led to code fragments like the one shown here:Out.println("<HTML>\n<HEAD>\n<TITLE>Thank you forRegistering</TITLE></HEAD>\n");Out.println("<IMG SRC=\"thanks.jpg\" WIDTH=200 HEIGHT=100 ALIGN=\"LEFT\”>");This kind of embedding gets very old very fast when you have to code a lot of pages. In addition, having to escape all of the quotation marks can lead to a lot of confusing andhard-to-find errors if you leave out a backslash. Eventually, a still-better idea emerged. Suppose that you could combine the best of static HTML pages and with the interactive capabilities of servlets. The result was JavaServer Pages (on the Microsoft side, the result was Active Server Pages). As Figure I.1 shows, JSP is a complicated beast. In the next chapter, you'll walk through this flow in detail, but for the moment, here are the major steps:1. A request comes in from a browser using the normal HTTP request format.2. The Web server hands off the request to JSP. JSP looks at the filename and finds the appropriate JSP file.3. The .jsp file is converted into a .java file, containing Java code that will create a class whose name is derived from the .jsp filename.4. JSP then compiles the .java file using javac to produce a .class file. Note that the two previous steps are skipped if a .class file already exists and is newer than the .jsp file.5. An instance of the newly created class is instantiated and sent the _jspService message.6. The new instance looks to see if there is already an instance of the er object called user existing in the session object space for the currently connected user. If not, one is instantiated.7. As part of servicing stuff.jsp, the user instance is called with the getUserName() method.8. If the JSP processing requires access to information in a database, it uses JDBC to make the connection and handle the SQL requests.As you can see, a tremendous amount of power is available in the JSP world. Developers are free to write Web pages that look mostly like HTML, except where callouts to Java are required. But, at the same time, they are free to develop fully fleshed-out object-oriented applications using all the features that Java can bring to bear. They also get all the benefits of servlets, including session persistence.Why Do We Need Databases?Well, one reason is so that Larry Ellison of Oracle can afford to keep himself on Prozac when he thinks about Bill Gates. A more serious answer is the same reason that drove man to first press a stick against a piece of wet mud: because it's good to write things down. Web servers are marvelous creatures, but they're a bit like idiot savants. Ask them to serve a Web page or run a piece of Java, and they perform like a champ. But start asking them to remember what they didfive minutes ago, and they develop amnesia faster than a character in a soap opera.The first and most important reason that you use databases is that there's a lot in an e-commerce transaction that you need to remember and track:•A user's name, address, credit card, and other information previously entered on a registration page•hat the user might have put into a shopping car t and left from a previous transaction•What items are in stock, along with their price, description, and so on•Orders that need to be fulfilled, orders that have been shipped, and items that have been backordered .Now, you could store all this information in a flat file on the server's hard disk, but there are other important properties that you want to have for this data:•You want to be able to back out a transaction if part of it fails.•You want to be able to locate the data somewhere more secure than the Web server, which could be in a DMZ or outside the firewall altogether.•You want to be able to access data such as user data or products quickly, even if there are thousands or millions of them.When you add these items to the shopping list, only a relational database will really do the job effectively.MySQLMany sites don't need the battleship strength (and price tag) of Oracle. MySQL is an open-source SQL database available for anyone to use, with many (although not all) of the features of its big brothers, such as Oracle.MySQL is available for just about any computer that has decent power—it is fairly lightweight on the processor and easy to install (10 minutes, as opposed to multiple hours for Oracle).So, perhaps you are wondering, what's the catch? What are you not getting in MySQL that makes people turn to Oracle? Well, MySQL is a neat little package, but it is missing some things that would be nice to have in a perfect world.A major feature that MySQL does not offer is database consistency checking. You can useforeign key tags in your schema, but MySQL cheerfully ignores them. A lot of DB As I know would consider this a very bad thing.A foreign key constraint prevents you from creating inconsistent data. For example, let's suppose that you had a scheme that looked like this:CREATE TABLE USER (USERID INTEGER,FIRST_NAME V ARCHAR(80),LAST_NAME V ARCHAR(80));CREATE TABLE PURCHASE (USERID FOREIGN KEY USER(USERID),ITEM INTEGER,QUANTITY INTEGER);In a database such as Oracle's, if you created an entry in the PURCHASE table with a user ID of 3, there would have to already be a user ID of 3 in the USER table or an error would occur. Similarly, you couldn't delete user 3 from USER if it was referenced in PURCHASE.The MySQL folks make a pretty impassioned argument in their documentation that depending on foreign keys for data integrity is a bad idea anyway, but convincing your DBA of this philosophy is likely to degrade into a religious debate.In addition, some other features are missing, such as subselects and select into. But probably the other major piece that you will miss is the rollback/commit functionality. MySQL does implement rollback and commit for certain types of tables, but not all of them. Again, the MySQL folks offer their own spin on why this is okay, but being able to roll back transactions is (in my opinion) important enough to make sure that you have it available.Rollback allows you to set a savepoint on the database before starting to do a series of transactions with it, and be able to either roll back to the original state or commit the changes at the end. For example, when recording a purchase, you need to record a debit against the user's account and enter a record into the shipping table so that you'll know later to ship the item. Let's say that the second part fails. You wouldn't want to charge the user but not ship the item. Thus, you'd want to roll back to the state before the transaction began.So, MySQL isn't a full-blown production database—at least, not yet. It's still good enoughfor probably 90% of the e-commerce sites in the world, however. And version 4.0, which is in alpha as of this writing, addresses a number of these concerns, including row-level locking and transaction control.Putting Tomcat and MySQL TogetherCombining Tomcat and MySQL provides a powerful, reliable, and free platform that you can use to learn, develop, and deploy JSP applications. And, best of all, the code that you develop using this platform will run nicely using iPlanet and Oracle or WebSphere and SQL Server.As a learning tool the two together are almost "reference implementations" of their respective protocols (JSP and SQL). As a result, you won't pick up any nasty vendor-proprietary bad habits while you're getting up to speed.In addition, you can enjoy the knowledge that you are supporting the open-source software movement. Open-source software is code that is made freely available under one of several public licenses, frequently the GNU General Public License (GPL).Why is it good to support this movement? There are two sides to this answer: one technical and one political. Technically, it's a good thing because open-source software tends to encourage the development of open standards such as JSP and JDBC, allowing youto choose your tools from among a larger group rather than being locked into one vendor's proprietary solution. It's a positive thing politically because it keeps the large companies honest. WebLogic and iPlanet have to stay competitive and responsive because they know that there's a free solution out there if they aren't. And when you use open-source software, you are sending a message that your overriding concerns are features and reliability, not having a large company to sue if something goes wrong.MySQL和JSP的Web应用程序JSP开发人员构建Web应用程序时遇到需要强大的数据库连接的特殊问题。

基于JSP的图书管理系统设计与实现

基于JSP的图书管理系统设计与实现

基于JSP的图书管理系统设计与实现随着互联网技术的不断发展,基于Web的应用程序越来越普及,而JSP(JavaServer Pages)技术是其中最常用的一种。

本文将介绍如何使用JSP技术设计和实现一个图书管理系统。

一、系统需求分析图书管理系统需要满足以下需求:1、用户可以查看图书列表、搜索图书、添加图书、编辑图书和删除图书。

2、管理员可以查看用户列表、添加用户、编辑用户和删除用户。

3、系统需要提供用户登录和权限管理功能。

二、系统设计1、数据库设计本系统采用MySQL数据库。

数据库中包含以下表:1、book:存储图书信息,包括book_id、title、author、publisher、price、isbn等字段。

2、user:存储用户信息,包括user_id、username、password、role 等字段。

3、login_log:存储用户登录日志,包括user_id、login_time等字段。

2、系统架构设计本系统采用MVC模式进行设计,分为模型层、视图层和控制层。

模型层负责处理数据和业务逻辑,视图层负责展示页面,控制层负责控制流程。

3、系统功能模块设计本系统分为以下几个模块:1、用户模块:包括用户注册、登录、找回密码等功能。

2、图书模块:包括查看图书列表、搜索图书、添加图书、编辑图书和删除图书等功能。

3、权限模块:包括权限控制和角色管理等功能。

4、日志模块:包括查看登录日志等功能。

三、系统实现1、用户模块实现用户模块主要包括用户注册、登录和找回密码等功能。

在JSP页面中,可以使用HTML表单来接收用户输入的信息,然后通过JSP代码将信息提交给Servlet进行处理。

在Servlet中,可以使用Java代码对用户输入的信息进行验证,并将验证结果返回给JSP页面进行展示。

2、图书模块实现图书模块主要包括查看图书列表、搜索图书、添加图书、编辑图书和删除图书等功能。

在JSP页面中,可以使用HTML表格来展示图书列表,使用HTML表单来接收用户的搜索信息,使用JSP代码将信息提交给Servlet进行处理。

外文翻译---Servlet和JSP技术简介

外文翻译---Servlet和JSP技术简介

附录一外文原文(摘自Marty Hall and Larry Brown,2000-07,Core Servlets and JavaServer Pages 第一章)An Overview of Servlet and JSP Technology1.1 A Servlet's JobServlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 1-1.Figure 1-11.Read the explicit data sent by the client.The end user normally enters this data in an HTML form on a Web page. However, the data could also come from an applet or a custom HTTP client program.2.Read the implicit HTTP request data sent by the browser.Figure 1-1 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and compression schemes the browser understands, and so on.3.Generate the results.This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or computing the response directly. Your real data may be in a relational database. Fine. But your database probably doesn't speak HTTP or return results in HTML, so the Web browser can't talk directly to the database. Even if it could, for security reasons, you probably would not want it to. The same argument applies to most other applications.You need the Web middle layer to extract theresultsinside a document.4.Send the explicit data (i.e., the document) to the client.This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or even a compressed format like gzip that is layered on top of some other underlying format. But, HTML is by far the most common format, so an important servlet/JSP task is to wrap the results inside of HTML.5.Send the implicit HTTP response data.Figure 1-1 shows a single arrow going from the Web middle layer (the servlet or JSP page) to the client. But, there are really two varieties of data sent: the document itself and the behind-the-scenes HTTP information. Again, both varieties are critical to effective development. Sending HTTP response data involves telling the browser or other client what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks.1.2 Why Build Web Pages Dynamically?Many client requests can be satisfied by prebuilt documents, and the serverwould handle these requests without invoking servlets. In many cases, however, a static result is not sufficient, and a page needs to be generated for each request. There are a number of reasons why Web pages need to be built on-the-fly: 1.The Web page is based on data sent by the client.For instance, the results page from search engines and order-confirmation pages at online stores are specific to particular user requests. You don't know what to display until you read the data that the user submits. Just remember that the user submits two kinds of data: explicit (i.e., HTML form data) and implicit (i.e., HTTP request headers). Either kind of input can be used to build the output page. In particular, it is quite common to build a user-specific page based on a cookie value.2.The Web page is derived from data that changes frequently.If the page changes for every request, then you certainly need to build the response at request time. If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server (independently of client requests), or you could wait and only build the page when the user requests it. The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request. For example, a weather report or news headlines site might build the pages dynamically, perhaps returning a previously built page if that page is still up to date.3.The Web page uses information from corporate databases or other server-side sources.If the information is in a database, you need server-side processing even ifthe client is using dynamic Web content such as an applet. Imagine using an applet by itself for a search engine site:"Downloading 50 terabyte applet, please wait!" Obviously, that is silly; you need to talk to the database. Going from the client to the Web tier to the database (a three-tier approach) instead of from an applet directly to a database (a two-tier approach) provides increased flexibility and security with little or no performance penalty. After all, the database call is usually the rate-limiting step, so going through the Web server does not slow things down. In fact, a three-tier approach is often faster because the middle tier can perform caching and connection pooling.In principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as well. For example, servlets could be embedded in FTP or mail servers to extend their functionality. And, a servlet API for SIP (Session Initiation Protocol) servers was recently standardized (see /en/jsr/detail?id=116). In practice, however, this use of servlets has not caught on, and we'll only be discussing HTTP servlets.1.3 The Advantages of Servlets Over "Traditional" CGIJava servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies.1.EfficientWith traditional CGI, a new process is started for each HTTP request. If the CGI program itself is relatively short, the overhead of starting the process candominate the execution time. With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process. Similarly, in traditional CGI, if there are N requests to the same CGI program, the code for the CGI program is loaded into memory N times. With servlets, however, there would be N threads, but only a single copy of the servlet class would be loaded. This approach reduces server memory requirements and saves time by instantiating fewer objects. Finally, when a CGI program finishes handling a request, the program terminates. This approach makes it difficult to cache computations, keep database connections open, and perform other optimizations that rely on persistent data. Servlets, however, remain in memory even after they complete a response, so it is straightforward to store arbitrarily complex data between client requests.2.ConvenientServlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too? You're already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++. Why go back to those languages for server-side programming?3.PowerfulServlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using aserver-specific API. Communicating with the Web server makes it easier to translate relative URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.4.PortableServlets are written in the Java programming language and follow a standard API. Servlets are supported directly or by a plugin on virtually every major Web server. Consequently, servlets written for, say, Macromedia JRun can run virtually unchanged on Apache Tomcat, Microsoft Internet Information Server (with a separate plugin), IBM WebSphere, iPlanet Enterprise Server, Oracle9i AS, or StarNine WebStar. They are part of the Java 2 Platform, Enterprise Edition (J2EE; see /j2ee/), so industry support for servlets is becoming even more pervasive.5.InexpensiveA number of free or very inexpensive Web servers are good for development use or deployment of low- or medium-volume Web sites. Thus, with servlets and JSP you can start with a free or inexpensive server and migrate to more expensive servers with high-performance capabilities or advanced administration utilities only after yourproject meets initial success. This is in contrast to many of the other CGI alternatives, which require a significant initial investment for the purchase of a proprietarypackage.Price and portability are somewhat connected. For example, Marty tries tokeep track of the countries of readers that send him questions by email. India was near the top of the list, probably #2 behind the U.S. Marty also taught one of his JSP and servlet training courses (see /) in Manila, and there was great interest in servlet and JSP technology there.Now, why are India and the Philippines both so interested? We surmise that the answer is twofold. First, both countries have large pools of well-educated software developers. Second, both countries have (or had, at that time) highly unfavorable currency exchange rates against the U.S. dollar. So, buying a special-purpose Web server from a U.S. company consumed a large part of early project funds.But, with servlets and JSP, they could start with a free server: Apache Tomcat (either standalone, embedded in the regular Apache Web server, or embedded in Microsoft IIS). Once the project starts to become successful, they could move to a server like Caucho Resin that had higher performance and easier administration but that is not free. But none of their servlets or JSP pages have to be rewritten. If their project becomes even larger, they might want to move to a distributed (clustered) environment. No problem: they could move to Macromedia JRun Professional, which supports distributed applications (Web farms). Again, none of their servlets or JSP pages have to be rewritten. If the project becomes quite large and complex, they might want to use Enterprise JavaBeans (EJB) to encapsulate their business logic. So, they might switch to BEA WebLogic or Oracle9i AS. Again, none of their servlets or JSP pages have to be rewritten. Finally, if their project becomes even bigger, they might move it off of their Linux box and onto an IBM mainframe running IBM WebSphere. But once again, none of their servlets or JSP pages have to be rewritten.6.SecureOne of the main sources of vulnerabilities in traditional CGI stems from the fact that the programs are often executed by general-purpose operating system shells. So, the CGI programmer must be careful to filter out characters such as backquotes and semicolons that are treated specially by the shell. Implementing this precaution is harder than one might think, and weaknesses stemming from this problem are constantly being uncovered in widely used CGI libraries.A second source of problems is the fact that some CGI programs are processed by languages that do not automatically check array or string bounds. For example, in C and C++ it is perfectly legal to allocate a 100-element array and then write into the 999th "element," which is really some random part of program memory. So, programmers who forget to perform this check open up their system to deliberate or accidental buffer overflow attacks.Servlets suffer from neither of these problems. Even if a servlet executes a system call (e.g., with Runtime.exec or JNI) to invoke a program on the local operating system, it does not use a shell to do so. And, of course, array bounds checking and other memory protection features are a central part of the Java programming language.7.MainstreamThere are a lot of good technologies out there. But if vendors don't support them and developers don't know how to use them, what good are they? Servlet and JSP technology is supported by servers from Apache, Oracle, IBM, Sybase, BEA, Macromedia, Caucho, Sun/iPlanet, New Atlanta, ATG, Fujitsu, Lutris, Silverstream, the World Wide Web Consortium (W3C), and many others.Several low-cost plugins add support to Microsoft IIS and Zeus as well. They run on Windows, Unix/Linux, MacOS, VMS, and IBM mainframe operating systems. They are the single most popular application of the Java programming language. They are arguably the most popular choice for developing medium to large Web applications. They are used by the airline industry (most United Airlines and Delta Airlines Web sites), e-commerce (), online banking (First USA Bank, Banco Popular de Puerto Rico), Web search engines/portals (), large financial sites (American Century Investments), and hundreds of other sites that you visit every day.Of course, popularity alone is no proof of good technology. Numerous counter-examples abound. But our point is that you are not experimenting with a new and unproven technology when you work with server-side Java.附录二中文翻译Servlet和JSP技术简介1.1 Servlet的功能Servlets是运行在Web或应用服务器上的Java程序,它是一个中间层,负责连接来自Web浏览器或其他HTTP客户端和HTTP服务器上的数据库或应用程序。

外文资料翻译---Struts 和 Tiles 辅助基于组件的开发

外文资料翻译---Struts 和 Tiles 辅助基于组件的开发

题目名称:Struts And Tiles Aid Component-basedDevelopment译文题目:Struts 和 Tiles 辅助基于组件的开发原文题目:Struts and Tiles aid component-based development 原文出处:Thinking in Java, 3rd ed. Revision 4.0Struts 和 Tiles 辅助基于组件的开发1994 年,当时主流的采用Web 应用程序的开发才刚开始。

由于Web 的不成熟,只有较少的工具能帮助开发人员构建Web 软件。

结果,在特定解决方案中的应用程序混合了HTML 代码与应用程序逻辑。

很显然,UI 设计的更改和业务逻辑的更新在大型应用程序中既困难又昂贵,因为紧耦合的表示和逻辑将这两种元素搅和在一起,进而导致错误和缓慢的进展。

而且,混合的代码要求部分开发人员具备UI 设计知识,或者要求开发人员与图形设计人员之间有紧密的工作关系,这常常会造成时间上的浪费。

JSP 技术和标记的引入稍微改善了这种更改问题,因为能够将逻辑和显示分离。

UI 设计人员能够对显示进行卓有成效的工作,同时开发人员能够专注于逻辑。

然而,这种方法仍存在一些缺陷。

尤其是某些操作(还有公共操作)的开发仍很困难。

验证表单就是典型的例子。

正如很多人所知,表单验证的过程类似于这样:显示表单;等待用户填写然后提交数据。

检查各个域值是否有效;如果有错误,则重新显示表单。

处理用户输入的数据,可能将其存储在一个数据库中。

在新页面上向用户显示处理的结果或下一步(可能是另一个表单)。

如果在这一过程中只使用JSP 页面,那么在需要再次更改代码时,您会发现,按照可管理性这条思路,将控制从一个页面“路由”至另一个页面很难。

您想把第4 步和第 3 步置于同一个页面吗?如果使用多个单独的JSP 页面,那么如何跟踪哪个页面链接至其它页面,以及在要更改一个页面的文件名或位置时该怎么做呢?而且,在第 2 步检测到某个域中的错误时,如何重新显示带有一条错误消息的原始表单,但还要保留用户已填入的值呢?Struts,一种开放源码“模型-视图-控制器”框架,通过帮助解决所有这些问题,从而使开发人员的工作更为轻松。

JAVA学习过程论文中英文资料对照外文翻译文献

JAVA学习过程论文中英文资料对照外文翻译文献

JAVA学习过程论文中英文资料对照外文翻译文献During my process of learning Java。

I have found that everyone has their own unique study method。

What works for one person may not work for another。

As I am studying Java independently。

I have not asked ___。

I have had to rely on my own ___ out。

While I cannot say whether this is the best method。

I can offer it as a reference for others.When I first started learning Java。

___ understanding of the language。

As I progressed。

I began to work on small projects to apply what I had learned.One of the biggest challenges I faced was understanding object-oriented programming。

___。

once I understood the basics。

everything else started to fall into place.___ practicing programming。

I also made sure to take breaks and give my brain time to rest。

I found that this helped me to ___.Overall。

my learning process has been a n of n。

企业人力资源管理系统外文翻译

企业人力资源管理系统外文翻译

Enterprise Human Resources Management System Design AndImplementationAbstract:Human resource management system is the core content of modern enterprise management. With the rapid development of the computer information technology and unprecedented prevalence of electronic commerce mode,the competition between enterprises is turning from visible economic markets to the network. Developing the human resource management system supported by computer technology,network technology and information technology can not only improve the skill of human resource management and the efficiency of the enterprises but also make human resource management modern and decision sciencefic,Modern human resource management uses B/S mode to avoid C/S modes short coming of difficult in maintdning and reusing.According to the functional requirements of the actual project,this article specificly state the analysis of system,the general desigin of the system,the detail design of system and the practice of the system.The development of the system is the practice of MVC design ideas, maing using the Jsp+Servlet+JavaBean form of development.Jsp is the practice of MVC design ideas’view,in charge of receiving/responding the request of the customer.Servlet mainly responsible for the core business control of the whole system is the practice of the vontroller of MVC design idea to take charge of the statistics and rules of the whole system. In the practice of the system, somr open-source projrcts,such as the Ajax technique,JfreChart statements,fileupload technology,has been used.Using the modern human resource management theropy and analysising the actual situation, comparing the current situation of human resource management system, a huaman resource contents of management system basied on the Internet/Intranet has been designed. The main management,attendance management training more efficient statistics.Keywords: human resource management; B/S mode; Open-source projects; MVC mode. 摘要人力资源管理系统是现代企业管理的核心内容。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

图书管理系统外文翻译(将Servlet和JSP组合使用)重庆三峡学院毕业设计(论文)外文资料翻译设计(论文)题目图书管理系统院系计算机科学与工程学院专业计算机科学与技术年级2009级1班学生学号2008908112学生姓名管金凤外文出处CHINA-USA Business Review指导教师评语:签名:年月日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 andpowerful, 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 / doPost / 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-platformcapability. 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.After another visit this page to the customer, as long as the paper there have been no changes, JSP engine has been loaded directly call the Servlet. If you have already been modified, it will be once again the implementation of the above process,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 the servlet. 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 isdistributed 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're out 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 acontainer that temporarily saves session state to disk or migrates a session to another server). A new session 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 shutsdown.Picking the Right Component Type for Each TaskThe Project Billboard application introduced is a fairly complex application. Half the pages are pure controller and business logic 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 aspecific data schema or database engine in more than one part of theapplication: beans in the role of Model can be used to accomplish this.●The database access beans must be made available to all other partsof the application when it starts: an application lifecycle event listener is theperfect component type for this task.●Only authenticated users must be allowed to use the application: afilter can perform access control to satisfy this requirement.●Request processing is best done with Java code: a servlet, acting asthe Controller, fits the bill.●It must be easy to change the presentation: this is where JSP shines,acting as the View.Adding servlets, listeners, and filters to the mix minimizes the need for 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 Controllerservlet.●The servlet must be able to distinguish requests for different types ofprocessing.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 ofprocessing requests in a flexible manner.●A mechanism for changing the page flow of the application withoutmodifying code.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开发服务器端应用的主要技术,是开发商务应用表示端的标准。

相关文档
最新文档