Struts开源框架中英文对照外文翻译文献

合集下载

J2EE开发框架外文翻译文献

J2EE开发框架外文翻译文献

中英文资料外文翻译文献J2EE开发框架Java2企业版为中间件领域思想的统一上发挥了很大的作用。

比如,J2EE为分布式事务管理、目录服务和消息服务提供了一套标准的编程接口。

J2EE的基础——Java2标准版(J2SE) ,成功地为Java提供了一套访问关系数据库的标准。

但是,就像本文中“J2EE缺乏对编程的支持”提到的一样,J2EE这个平台没有能够提供一个令人满意的应用程序编程模型。

Sun公司和一些大的应用服务器供应商都想用开发工具来降低J2EE开发的复杂性,但是这些工具没有其他的JA V A 开发工具优秀,后者有先进的重构工具,和.NET平台相比,J2EE的工具支持显得很逊色。

很多J2EE开发工具自动产生的代码像这些工具本身同样复杂。

在开源社区很多小型J2EE开发者选择了另外一种开发方式——一些可以降低J2EE开发难度的开发框架,较为流行的比如:Struts, Hibernate, 和Spring Framework,他们当今很多J2EE项目种扮演着重要角色。

为什么要采用框架?框架是一由一些类组成,正式这些类为应用程序提供了一个可重用的设计――或者我们经常提到的——应用程序种的一层。

应用程序代码访问类库从而执行任务,而框架是调用应用程序代码,从而管理程序的流程。

这就是经常说道的好莱坞原则:“不要试图联系我们,我们到时候自会通知你。

”开发者写的程序在运行时由框架调用。

设计一个在各种未知背景下都可以使用的框架是很有挑战性的。

框架很适合在复杂的J2EE开发中使用,它可以为开发者提供一个简单易用的模型。

采用一个经过良好设计的开源框架有很多好处:1、在好的框架下,开发者只需要写一些必须的代码;他们不需要直接接触底层的API。

这一点很重要。

2、经过良好设计的框架可以为程序提供清晰的结构并且提高程序的内聚性。

好清晰的结构使得其他人可以更容易加入项目。

3、一个容易使用的框架可以通过一些例子和文档为用户提供最佳实践。

计算机毕业设计外文翻译

计算机毕业设计外文翻译

Hibernate. 其中,服务器端表示层由 Struts 框架来描
述 MVC 框架,业务逻辑层由 Spring 框架的 IoC 容器
来协助完成,持久层由 Hibernate 框架的对象关系映
射 (O/R Mapping) 来完成与数据库的交互,服务器端
表示层和业务逻辑层通过域模型层的 VO (Value
在多层结构设计中,提倡的是对接口进行编程的设计方式,在编程中只引用接口而不用具体的实现类,
在装载时才配置具体的实现类实例. 如接口类 TestDao(TestBean 是我们要处理的持久化类)定义如下:
public interface TestDao// 接口类 void createBean( TestBean Testbean) throws DataAccessException// 持久化 void updateBean(TestBean Testbean) throws DataAccessExcept void deleteBean(int Te stldω) throws DataAccessException; 臼 矿扩删 除垛 Bean l
采用新的高效的开发模式,并且随着 ]ava 组件的迅速开发,许多技术包括 AOP 和 IoC 为 JavaBeans 提供了
很多像 E]B 才拥有的强大功能,为 ]avaBeans 提供了类似 E]B 的声明式编程模型,但并没有带来任何像 E]B
那样的复杂问题 [I J • ]2EE 复杂的多层结构、庞大的体系决定了 ]2EE 项目需要运用框架和设计模式来控制
以定义所要配置的属性以及要注入的值.可以注入任何东西,从基本类型到集合类,甚至是应用系统中的其 他 Bean ,也可以通过 <ref> 标签注入.

软件工程中英文对照外文翻译文献

软件工程中英文对照外文翻译文献

中英文对照外文翻译(文档含英文原文和中文翻译)Application FundamentalsAndroid applications are written in the Java programming language. The compiled Java code — along with any data and resource files required by the application — is bundled by the aapt tool into an Android package, an archive file marked by an .apk suffix. This file is the vehicle for distributing the application and installing it on mobile devices; it's the file users download to their devices. All the code in a single .apk file is considered to be one application.In many ways, each Android application lives in its own world:1. By default, every application runs in its own Linux process. Android starts the process when any of the application's code needs to be executed, and shuts down the process when it's no longer needed and system resources are required by other applications.2. Each process has its own virtual machine (VM), so application code runs in isolation from the code of all other applications.3. By default, each application is assigned a unique Linux user ID. Permissions are set so that the application's files are visible only to that user and only to the application itself — although there are ways to export them to other applications as well.It's possible to arrange for two applications to share the same user ID, in which case they will be able to see each other's files. To conserve system resources, applications with the same ID can also arrange to run in the same Linux process, sharing the sameVM.Application ComponentsA central feature of Android is that one application can make use of elements of other applications (provided those applications permit it). For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own. Your application doesn't incorporate the code of the other application or link to it. Rather, it simply starts up that piece of the other application when the need arises.For this to work, the system must be able to start an application process when any part of it is needed, and instantiate the Java objects for that part. Therefore, unlike applications on most other systems, Android applications don't have a single entry point for everything in the application (no main() function, for example). Rather, they have essential components that the system can instantiate and run as needed. There are four types of components:ActivitiesAn activity presents a visual user interface for one focused endeavor the user can undertake. For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions. A text messaging application might have one activity that shows a list of contacts to send messages to, a second activity to write the message to the chosen contact, and other activities to review old messages or change settings. Though they work together to form a cohesive user interface, each activity is independent of the others. Each one is implemented as a subclass of the Activity base class.An application might consist of just one activity or, like the text messaging application just mentioned, it may contain several. What the activities are, and how many there are depends, of course, on the application and its design. Typically, one of the activities is marked as the first one that should be presented to the user when the application is launched. Moving from one activity to another is accomplished by having the current activity start the next one.Each activity is given a default window to draw in. Typically, the window fills the screen, but it might be smaller than the screen and float on top of other windows. An activity can also make use of additional windows — for example, a pop-up dialog that calls for a user response in the midst of the activity, or a window that presents users with vital information when they select a particular item on-screen.The visual content of the window is provided by a hierarchy of views — objects derived from the base View class. Each view controls a particular rectangular space within the window. Parent views contain and organize the layout of their children. Leaf views (those at the bottom of the hierarchy) draw in the rectangles they control and respond to user actions directed at that space. Thus, views are where the activity's interaction with the user takes place.For example, a view might display a small image and initiate an action when the user taps that image. Android has a number of ready-made views that you can use —including buttons, text fields, scroll bars, menu items, check boxes, and more.A view hierarchy is placed within an activity's window by theActivity.setContentView() method. The content view is the View object at the root of the hierarchy. (See the separate User Interface document for more information on views and the hierarchy.)ServicesA service doesn't have a visual user interface, but rather runs in the background for an indefinite period of time. For example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it. Each service extends the Service base class.A prime example is a media player playing songs from a play list. The player application would probably have one or more activities that allow the user to choose songs and start playing them. However, the music playback itself would not be handled by an activity because users will expect the music to keep playing even after they leave the player and begin something different. To keep the music going, the media player activity could start a service to run in the background. The system would then keep the music playback service running even after the activity that started it leaves the screen.It's possible to connect to (bind to) an ongoing service (and start the service if it's not already running). While connected, you can communicate with the service through an interface that the service exposes. For the music service, this interface might allow users to pause, rewind, stop, and restart the playback.Like activities and the other components, services run in the main thread of the application process. So that they won't block other components or the user interface, they often spawn another thread for time-consuming tasks (like music playback). See Processes and Threads, later.Broadcast receiversA broadcast receiver is a component that does nothing but receive and react to broadcast announcements. Many broadcasts originate in system code — for example, announcements that the timezone has changed, that the battery is low, that a picture has been taken, or that the user changed a language preference. Applications can also initiate broadcasts — for example, to let other applications know that some data has been downloaded to the device and is available for them to use.An application can have any number of broadcast receivers to respond to any announcements it considers important. All receivers extend the BroadcastReceiver base class.Broadcast receivers do not display a user interface. However, they may start an activity in response to the information they receive, or they may use the NotificationManager to alert the user. Notifications can get the user's attention in various ways — flashing the backlight, vibrating the device, playing a sound, and so on. They typically place a persistent icon in the status bar, which users can open to get the message.Content providersA content provider makes a specific set of the application's data available to other applications. The data can be stored in the file system, in an SQLite database, or in anyother manner that makes sense. The content provider extends the ContentProvider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls. However, applications do not call these methods directly. Rather they use a ContentResolver object and call its methods instead. A ContentResolver can talk to any content provider; it cooperates with the provider to manage any interprocess communication that's involved.See the separate Content Providers document for more information on using content providers.Whenever there's a request that should be handled by a particular component, Android makes sure that the application process of the component is running, starting it if necessary, and that an appropriate instance of the component is available, creating the instance if necessary.Activating components: intentsContent providers are activated when they're targeted by a request from a ContentResolver. The other three components — activities, services, and broadcast receivers — are activated by asynchronous messages called intents. An intent is an Intent object that holds the content of the message. For activities and services, it names the action being requested and specifies the URI of the data to act on, among other things. For example, it might convey a request for an activity to present an image to the user or let the user edit some text. For broadcast receivers, theIntent object names the action being announced. For example, it might announce to interested parties that the camera button has been pressed.There are separate methods for activating each type of component:1. An activity is launched (or given something new to do) by passing an Intent object toContext.startActivity() or Activity.startActivityForResult(). The responding activity can look at the initial intent that caused it to be launched by calling its getIntent() method. Android calls the activity's onNewIntent() method to pass it any subsequent intents. One activity often starts the next one. If it expects a result back from the activity it's starting, it calls startActivityForResult() instead of startActivity(). For example, if it starts an activity that lets the user pick a photo, it might expect to be returned the chosen photo. The result is returned in an Intent object that's passed to the calling activity's onActivityResult() method.2. A service is started (or new instructions are given to an ongoing service) by passing an Intent object to Context.startService(). Android calls the service's onStart() method and passes it the Intent object. Similarly, an intent can be passed to Context.bindService() to establish an ongoing connection between the calling component and a target service. The service receives the Intent object in an onBind() call. (If the service is not already running, bindService() can optionally start it.) For example, an activity might establish a connection with the music playback service mentioned earlier so that it can provide the user with the means (a user interface) for controlling the playback. The activity would call bindService() to set up that connection, and then call methods defined by the service to affect the playback.A later section, Remote procedure calls, has more details about binding to a service.3. An application can initiate a broadcast by passing an Intent object to methods like Context.sendBroadcast(), Context.sendOrderedBroadcast(), andContext.sendStickyBroadcast() in any of their variations.Android delivers the intent to all interested broadcast receivers by calling their onReceive() methods. For more on intent messages, see the separate article, Intents and Intent Filters.Shutting down componentsA content provider is active only while it's responding to a request from a ContentResolver. And a broadcast receiver is active only while it's responding to a broadcast message. So there's no need to explicitly shut down these components. Activities, on the other hand, provide the user interface. They're in a long-running conversation with the user and may remain active, even when idle, as long as the conversation continues. Similarly, services may also remain running for a long time. So Android has methods to shut down activities and services in an orderly way:1. An activity can be shut down by calling its finish() method. One activity can shut down another activity (one it started with startActivityForResult()) by calling finishActivity().2. A service can be stopped by calling its stopSelf() method, or by calling Context.stopService().Components might also be shut down by the system when they are no longer being used or when Android must reclaim memory for more active components. A later section, Component Lifecycles, discusses this possibility and its ramifications in more detail.The manifest fileBefore Android can start an application component, it must learn that the component exists. Therefore, applications declare their components in a manifest file that's bundled into the Android package, the .apk file that also holds the application's code, files, and resources.The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It does a number of things in addition to declaring the application's components, such as naming any libraries the application needs to be linked against (besides the default Android library) and identifying any permissions the application expects to be granted.But the principal task of the manifest is to inform Android about the application's components. For example, an activity might be declared as follows:The name attribute of the <activity> element names the Activity subclass that implements the activity. The icon and label attributes point to resource files containing an icon and label that can be displayed to users to represent the activity.The other components are declared in a similar way — <service> elements for services, <receiver> elements for broadcast receivers, and <provider> elements for content providers. Activities, services, and content providers that are not declared in the manifest are not visible to the system and are consequently never run. However, broadcast receivers can either be declared in the manifest, or they can be created dynamically in code (as BroadcastReceiver objects) and registered with the system by calling Context.registerReceiver().For more on how to structure a manifest file for your application, see The Android Manifest.xml File.Intent filtersAn Intent object can explicitly name a target component. If it does, Android finds that component (based on the declarations in the manifest file) and activates it. But if a target is not explicitly named, Android must locate the best component to respond to the intent. It does so by comparing the Intent object to the intent filters of potential targets. A component's intent filters inform Android of the kinds of intents the component is able to handle. Like other essential information about the component, they're declared in the manifest file. Here's an extension of the previous example that adds two intent filters to the activity:The first filter in the example — the combination of the action"android.intent.action.MAIN" and the category"UNCHER" — is a common one. It marks the activity as one that should be represented in the application launcher, the screen listing applications users can launch on the device. In other words, the activity is the entry point for the application, the initial one users would see when they choose the application in the launcher.The second filter declares an action that the activity can perform on a particular type of data.A component can have any number of intent filters, each one declaring a different set of capabilities. If it doesn't have any filters, it can be activated only by intents that explicitly name the component as the target.For a broadcast receiver that's created and registered in code, the intent filter is instantiated directly as an IntentFilter object. All other filters are set up in the manifest. For more on intent filters, see a separate document, Intents and Intent Filters.应用程序基础Android DevelopersAndroid应用程序使用Java编程语言开发。

Struts-一种开源MVC的实现毕业论文外文文献翻译及原文

Struts-一种开源MVC的实现毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目: Struts——一种开源MVC的实现文献、资料英文题目:文献、资料来源:文献、资料发表(出版)日期:院(部):专业:班级:姓名:学号:指导教师:翻译日期: 2017.02.14毕业设计(论文)外文资料翻译题目: Struts——An Open-source MVC ImplementationStruts——一种开源MVC的实现院系名称:专业班级:学生姓名:学号:指导教师:教师职称:起止日期:地点:附件: 1.外文资料翻译译文;2.外文原文。

指导教师评语:该生所译的“Struts——An Open-source MVC Implementation”一文与其毕业设计课题有一定的关联,译文整体较为准确,翻译后的文章符合中文的习惯。

但还有个别的词翻译的不够准确,个别的语句不够通顺。

总的来说此译文是一篇合格的译文。

签名: 20 年月日指导教师评语:该生所译的“ Technology for Web Application”一文与其毕业设计课题有一定的关联,译文整体较为准确,翻译后的文章符合中文的习惯。

但还有个别的词翻译的不够准确,个别的语句不够通顺。

总的来说此译文是一篇合格的译文。

签名:20 年月日Struts——An Open-source MVC Implementation附件1:外文资料翻译译文Struts——一种开源MVC的实现这篇文章介绍Struts,一个使用servlet 和JavaServer Pages 技术的一种Model-View-Controller 的实现。

Struts 可以帮助你控制Web 项目中的变化并提高专业化。

即使你可能永远不会用Struts实现一个系统,你可以获得一些想法用于你未来的servlet 和JSP 网页的实现中。

简介在小学校园里的小孩子们都可以在因特网上发布HTML 网页。

然而,有一个重大的不同在一个小学生和一个专业人士开发的网站之间。

Struts外文翻译

Struts外文翻译

英文翻译资料A.英文原文StrutsApache Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model-view-controller (MVC) architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in May, 2000. Formerly located under the Apache Jakarta Project and known as Jakarta Struts, it became a top level Apache project in 2005.Design goals and overviewIn a standard Java EE web application, the client will typically submit information to the server via a web form. The information is then either handed over to a Java Servlet which processes it, interacts with a database and produces an HTML-formatted response, or it is given to a JavaServer Pages (JSP) document which intermingles HTML and Java code to achieve the same result. Both approaches are often considered inadequate for large projects because they mix application logic with presentation and make maintenance difficult.The goal of Struts is to cleanly separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). Struts provides the controller (a servlet known as ActionServlet) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but XML/XSLT and Velocity are also supported). The web application programmer is responsible for writing the model code, and for creating a central configuration file struts-config.xml which binds together model, view and controller.Requests from the client are sent to the controller in the form of “Actions” defined in the configuration file; if the controller receives such a request it calls the corresponding Action class which interacts with the application specific model code. The model code returns an “ActionForward”, a string telling the controller which output page to send to the client. Information is passed between model and view in the form of special JavaBeans. A powerful custom tag library allows it to read and write the content of these beans from the presentation layer without the need for any embedded Java code.Struts also supports i18n (internationalization), provides facilities for the validation of data submitted by web forms, and includes a template mechanism called “Tiles” which (for instance) allows the presentation layer to be composed from independent header, footer, and content components.Competing MVC frameworksAlthough Struts is a well documented, mature and popular framework for building front ends to Java applications, it is facing new challenges from newer “light weight” MVC frameworks such as Spring MVC, Stripes and Tapestry. The newXForms standards and frameworks may also be another option to building complex web Form validations with Struts in the future.The WebWork framework spun off from Apache Struts several years ago, aiming to offer enhancements and refinements while retaining the same general architecture of the original Struts framework. However, it was announced in December 2005 that Struts would re-merge with WebWork. WebWork 2.2 has been adopted as Apache Struts 2, which reached its first full release in February 2007.Sun recently brought out a new addition to the Java platform, called JavaServer Faces (JSF). Aside from the original framework, the Apache Struts project also offers a JSF-based framework called Shale.Other MVC frameworks that are not J2EE based include Ruby on Rails, WebObjects, Django, Catalyst, TurboGears, CakePHP, Symfony (for PHP), Zend, Achievo ATK, and CodeIgniter (for PHP). Struts4php is a version of the Struts framework for the PHP web scripting language. Girders is a port of the Struts framework in C# for Microsoft .NET.Extracted from /B.原文的翻译StrutsStruts 是 Apache软件基金会(ASF)赞助的一个开源项目。

基于Struts框架的在线购物系统设计与实现-毕业论文外文文献翻译

基于Struts框架的在线购物系统设计与实现-毕业论文外文文献翻译

附录Design and Implementation of Online Shopping SystemBased on the Struts FrameworkAbstract: Struts is currently a prevalent Web application development framework based on MVC. It has prominence in the open, large and extensible J2EE-based Web application development. Through combining the actual operation process of E-commerce enterprise with the developed requirement, this paper categorically analyses MVC actual implementation technology, analyses and describes the Struts framework. Finally it gives a demonstrative example of Category management module, which explains in detail technical implementation to E-Online Shopping System based Struts framework and presents function description of correlative constitution section. By practical application, it shows the system improves platform’s security and stability.1.INTRODUCTION With the development of internet technology, network service plays an increasingly important role in people’s daily life. People expect that they can get the satisfied service or goods in a convenient way and in very short time. Hence, the electronic commerce system at this moment plays a very critical part. On one hand, it is very convenient for people to look at the goods online and it also shortens people’s time period for shopping. On the other hand, for the enterprise, it shortens intermediate links, and it can reduce the geographic restrictions and decreases the merchandise inventory pressure, therefore, it can greatly save business operating cost. However, this system also faces problems that the form of ecommerce is very changeable; as a result, the inner structural can be complex and varied. Then, how to deal with that? Based on the development model of Struts [1], it can effectively deal with these varied requirements. It completely changes the previous traditional J2EE development mode that is the coupling of display, control and business which makes software reuse difficult, cooperation and division of the team difficult, development time long and cost high. Therefore, this article based on the integrated development environment of MyEclipse and using MySQL as the backend database, the MVC OF Struts designed a crossplatform, extensible B/S electronic commerce system. This system is runs on the internet where users can browse the goods and buy them freely, they can even choose the payment method. Thissystem innovates the traditional shopping, which can make people buy what they want at home. The computational results of the system states that the system operates well and that its security and expandability are also high.2. INTRODUCTION OF STRUTSStruts [2] is an exceptional MVC frame. It combines features of Servelet and JSP and inherits various features of MVC, and it changes and extends according to the J2EE’S characteristic. There are three main parts of Struts: The controller is responsible for the Action that is processed by a specific operation; JSP page (view); that applies business logic packaging. The master controller of Struts (ActionServlet) receives the request from client and according to the allocated route of the system (Struts-config. xml) HTTP requests the objects to the other Action. In these action objects, it will make business operation and after operation, it will transfer from ActionServlet to JSP, and the processed results will be returned to clients. The packaging data through Action Form can be mutual used in Model and View. The working principle of Struts is showing in Fig. (1).3. THE ANALYSIS AND DESIGN OF ELECTRONIC COMMERCE SYSTEM3.1. The Demand Analisis and Case Design of the SystemThe aim of this electronic commerce system is realizedby the construction of this system. The most important thing is to attract customers to know the main product of the website, for instance an e-commerce website which mainly sells children’s shoes or children’s clothes and so on. For transactions, it has to build B to C sales model which are consumer facing, and it has to realize the integration of products, online payment, and logistic services. Moreover, it needs to make a customized search engine and data analysis system to find the potential and key customers. It also needs to analyze the market trend to build a scientific decision system [3].Therefore, the system requirement description is as following:electronic commerce system includes two subsystems; one is for the front desk sale and display. When clients log in, they can freely look over and search their favorite products (for example: off-price goods, new arrivals). Meanwhile, customers can put the products they like in a “shopping cart” and which they can later modify, (add or delete), then they can submit the order form to service counter to pay. The other subsystem is in the backstage management system. Merchants canmanage the relevant information published, typed-in and alteration. It can also manage the search of the order and manage the registered clients of on-line sales system. Meanwhile, it can analyze consumer behavior, which can provide evidence for better scientific decision for the corporation. Fig. (2) is the use case of this eshopping system.3.2. The E-R Design of Online Shopping SystemPowerDesigner [3, 4] is the CASE tool set of Sybase, it can make data flowchart, concept data model, physical data model and can also control the generated data model. This system uses PowerDesigner to set up data and induct E-R model to MySQL, and generate physical data sheets. Therefore, according to the above description, combined with the need and description of 2.1, the design of E-R can be finished. However, there are numerous system database sheets, only some important database sheets are listed here. The relationship among them will be explained here. The specific design of E-R is in (Fig. 3).3.3. Structure Design of Online Shopping System In this article, the system uses Struts based on MVC, which makes great convenience for the developer to make modularization exploitation. It greatly increased code’s reusability and maintainability, and it also takes the crossplatform of this system into consideration. Fig. (4) shows the design model of this online shopping system.① View is responsible for the systems visual theme and realization, and View is composed by JSP and Action Form bean. JSP contains static HTML, CSS, Div and Struts label database. Action Form bean is responsible for the data transmission between JSP and Model.① Controller is composed by Action Servlet. Its task are:first, it has to finish all the initialized work, that is to read the information in Struts-config. xml and intercept the matching map of URL by Action Servlet; second, according to the intercepting request initiate Action Form bean; last, to find the corresponding Action subclass in Action Mapping: if there are no corresponding Action, then transmit the request to JSP; if there are corresponding Action, then initiate ActionForm bean and use HTTP to fill the data and its property, and save these results in request for other Action or JSP to use.① in the Model [4], the specific business logic operationis finished by Action. In order to reduce the coupling relationshipbetween business logic and database manipulation,the DAO is used to separate business logic and data access.It can increase the flexibility and maintainability of systemfor that DAO model Action [5] and provides abstract data access port. Therefore, Model doesn’t need to care about selection, insertion, deletion, and updating, hence, it avoids mixed call statement in service code, so the business practice can be much clearer and on the other hand, because of the separation of data access port and data access, which can make the developer concentrate on business logic code rather than data’s selection, insertion, deletion, and check.4. THE IMPLEMENTATION OF ELECTRONIC COMMERCE SYSTEM BASED ON STRUTSStruts applied MVC design model, which separated page display, data control and business operation makes the exploitation and maintenance more convenient and reasonable. For online shopping electronic commerce system [6, 7], the construction methods of all modules are basically same. Next set commodity management module [8] as an example to explain the develop process of online shopping electronic commerce system based on Struts.4.1. Design of View ModuleThe main function of View is to display data to users, and in this system, View is composed by Struts, Div, CSS, HTML, JSP and formbean. The advantage of this is that it can avoid the coupling of Java source code and HTML statement in JSP, and it also can enhance reusability of View. It can simplify the page development, and is good for test and maintenance.. First, use Dreamweaver to establish JSP: 1), add and modify Category page addCategory.jsp;2), delete some category page delCategory.jsp;3), search category page searchCategory.jsp; 4), maintain category information page categoryInfoMaint.jsp. It can display all the products information and it can add, delete, modify and edit the selected products. Lastly, to define and describe the CategoryFormbean. It inherited the org.apache.struts.action.ActionForm in Struts. The main function of this class is to collect and display data. The goal of data collection is to provide a business model for Model module. And display data is to show the conducted data to users. The specific steps are:First: introduce ActionForm to Struts;Second. write down the specific codes as followingpublic class MerForm extends ValidatorForm { // 1.define products manufacturer\ private String manufacturer; // 2. define products price private Double sprice;// 3.define products discount private Integer special; …………… //omit other property,meanwhile,//generate corresponding Getter/Setter }4.2. Implementation and Design of ControllerController is the core of all operations, whenever, ActionServlet of controller deals with all the things, it decides all the flow relation of every module in this system. Then how to finish these works? Firstly, it is necessary to register ActionServlet and Struts-config.xml in Web.xml. Web.xml is the place where Controller’s modules ActionServlet and struts-config.xml are described and among these, *.do stands for requesting mapping, the specific allocations are:<servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><servlet>基于Struts框架的在线购物系统设计与实现摘要:Struts目前是一个基于MVC的流行的Web应用开发框架。

外文翻译--SSH

外文翻译--SSH

英文原文SSH is Spring + struts + Hibernate an integration framework, is one of the more popular a Web application framework.SpringLight weight -- from two aspects in terms of size and cost of the Spring are lightweight.A complete Spring framework can in one size only 1MB multiple JAR files released.And Spring required processing overhead is not worth mentioning.Inversion of control -- Spring through a known as inversion of control (IoC) technology promotes loose coupling.When using IoC, an object depend on other objects will be passed in through passive way, but not the object of its own to create or find a dependent object.You can think of IoC and JNDI instead -- not the object from the container for dependent, but in different container object is initialized object request on own initiative will rely on to it.Aspect oriented programming -- Spring provides rich support, allowed by separating the application's business logic and system level service cohesiondevelopment.Application object only realize they should do -- complete business logic.They are not responsible for other system level concerns.Container -- Spring contains and management application object configuration and life cycle, in this sense, it is a kind of container, you can configure each of your bean to be created -- Based on a reconfigurable prototype (prototype), your bean can create a single instance or every time when they are needed to generate a new examples -- and how they are interrelated.However, Spring should not be confused with the traditional heavyweight EJB container, they are often large and unwieldy, difficult to use.StrutsStruts on Model, View and Controller are provided with the corresponding components.ActionServlet, this is Struts core controller, responsible for intercepting the request from the user.Action, this class is typically provided by the user, the controller receives from the ActionServlet request, and according to the request to call the model business logic method to processing the request, and the results will be returned to the JSP page display.Part ModelBy ActionForm and JavaBean, where ActionForm used to package the user the request parameters, packaged into a ActionForm object, the object to be forwarded to the Action ActionServlet Action ActionFrom, according to which the request parameters processing a user request.JavaBean encapsulates the underlying business logic, including database access.Part ViewThis section is implemented by JSP.Struts provides a rich library of tags, tag library can be reduced through the use of the script, a custom tag library can be achieved with Model effective interaction, and increased practical function.The Controller componentThe Controller component is composed of two parts -- the core of the system controller, the business logic controller.System core controller, the corresponding ActionServlet.The controller is provided with the Struts framework, HttpServlet class inheritance, so it can be configured to mark Servlet.The controller is responsible for all HTTP requests, and then according to the user request to decide whether or not to transfer to business logic controller.Business logic controller, responsible for processing a user request, itself does not have the processing power, it calls the Model to complete the deal.The corresponding Action part.HibernateHibernate is an open source object relation mapping framework, it had a very lightweight JDBC object package, makes Java programmers can use arbitrary objects to manipulate database programming thinking.Hibernate can be applied in any use of JDBC occasions, can be in the Java client program to use, also can be in Servlet / JSP Web applications, the most revolutionary, Hibernate can be applied in the EJB J2EE schema to replace CMP, complete data persistence.The core of Hibernate interface has a total of 5, are: Session, SessionFactory, Query, Transaction and Configuration.The 5 core interface in any development will be used in.Through these interfaces, not only can the persistent object access, but also to carry out a transaction control.中文翻译SSH 为spring+ struts+ hibernate的一个集成框架,是目前较流行的一种Web 应用程序开源框架。

Spring框架-毕业论文外文文献翻译

Spring框架-毕业论文外文文献翻译

外文文献翻译SpringFrameworkSpring is an open source framework, and Spring was launched in 2003 as a lightweight Java development framework created by Rod Johnson.In a nutshell, Spring is a hierarchical, JavaSE/EEfull-stack (one-stop) lightweight open source framework.The powerful JavaBeans based configuration management using the Inversion of Control (IoC) principle makes application components faster and easier.1.facilitate decoupling and simplify developmentThrough the IoC container provided by Spring, we can control dependencies between objects by Spring, avoiding excessive program coupling caused by hard coding.With Spring, users do not have to write code for the bottom tier requirements of single instance schema classes, properties, file parsing, and so on, and can focus more on top tier applications.2.AOP programming supportThrough the Spring functionality provided by AOP, it is easy to implement face oriented programming, and many features that are not easily implemented with traditional OOP can be easily handled by AOP.3.declarative transaction supportIn Spring, we can extricate ourselves from tedious and tedious transaction management code and flexibly manage the transaction through declarative manner, so as to improve the efficiency and quality of development.4.convenience program testingAlmost all test work can be done in a non container dependent programming manner, and in Spring, testing is no longer expensive, but something to do.For example, Spring supports Junit4 and can easily test Spring programs by annotations.5.convenient integration of various excellent frameworkSpring does not exclude all kinds of excellent open source framework, on the contrary, Spring can reduce the difficulty of the use of Spring framework, provides a framework for a variety of excellent (such as Struts, Hibernate, Hessian, Quartz) directly support the.6.reduce the difficulty of using Java EE APISpring provides a thin layer of encapsulation for many difficult Java, EE, API (such as JDBC, JavaMail, remote calls, etc.), and the use of these Java EE API is greatly reduced through the simple package of Spring.7.Java source code is a classic example of learningSpring source code, clear structure, exquisite design originality, embodies the master of the Java design pattern and the flexible use of Java technology accomplishment.Spring framework source code is undoubtedly the best practice example of Java technology.If you want to quickly improve your Java skills and application development level in a short time, learning an.The role of MVC - Spring is integration, but not just integration, and the Spring framework can be seen as a framework for enterprise solution levels.The client sends a request, the server controller (implemented by DispatcherServlet) to complete the request forwarding, call a controller for mapping class HandlerMapping, the class is used to map requests to the corresponding processor to process the request.HandlerMapping will request is mapped to the corresponding processor Controller (equivalent to Action) in Spring if you write some processor components, the general implementation of the Controller interface in Controller, you can call Service or DAO to operate data from the DAO ModelAndView used to store the retrieved data, some data can also be stored in response to the view.If you want to return the result to the user, it also provides a view of ViewResolver component in Spring framework, the component labeled Controller returns according to, find the corresponding view, the response response back to the user.Each module (or component) that makes up the Spring framework can exist alone, or can be implemented in conjunction with one or more other modules.Each module has the following functions: 1, the core container: the core container provides the basic functionality of the Spring framework (Spring, Core).The main component of the core container is BeanFactory, which is implemented in factory mode.BeanFactory uses the control inversion (IOC) pattern to separate application configuration and dependency specifications from theactual application code.Spring框架Spring是一个开源框架, Spring是于2003 年兴起的一个轻量级的Java 开发框架, 由Rod Johnson创建。

Struts开源框架中英文对照外文翻译文献

Struts开源框架中英文对照外文翻译文献

中英文对照外文翻译文献(文档含英文原文和中文翻译)Best practices for Struts developmentStruts: A brief introductionStruts, an open source framework you can use to build Web applications, is based on the popular Model-View-Controller (MVC2) design paradigm. The framework is built upon standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, and it provides flexible and extensiblecomponents. Struts implements the Controller layer in the form of ActionServlet and recommends building the View layer using JSP tag libraries. Struts also provides a wrapper around theModel layer through Action classes. Figure 1 illustrates the Struts framework based on theModel-View-Controller design.Figure 1. Struts and MVCOverview of Struts componentsFirst, we'll explain the Struts components in the context of best practices and the role each one plays in your Web application development.ActionEvery Action of your application extendsStruts' org.apache.struts.action.Action. These Action classes provide an interface to the application's Model layer, acting as a wrapper around the business logic.Each Action class must provide its case-specific implementation to the perform() method. The perform() method always returns a value of type ActionForward. ActionFormEvery ActionForm of your application extendsStruts' org.apache.struts.action.ActionForm. ActionForm s are simple JavaBeans that encapsulate and validate request parameters. To validate your request data, your ActionForm's validate() method must give a case-specific implementation. ActionForm s serve as a carrier of request data to the Action class. A JSP object combines with a respective ActionForm to form your application's View layer, where almost every form field of the JSP object maps to an attribute of the corresponding ActionForm. JSP custom tag librariesThe JSP custom tag libraries are a collection of actions presented as tags. This is a powerful feature of the JSP Specification 1.1; it allows you to separate presentation from other application tiers. The libraries are easy to use and you can read them in XML-like fashion. You can easily maintain the JSP components by minimizing the use of Java scriptlets in them. The JSP tags that Struts provides include HTML, logic, and bean tags.ActionErrorsYou use ActionError s to support exception handling. An ActionError traps and propagates an application exception to the View layer. Each one is a collectionof ActionError instances. ActionError s encapsulate error messages, whilethe </html:errors> in the Presentation layer renders all error messages inthe ActionError collection.Best Practice 1. Reuse data across multiple ActionFormsNow that you are familiar with the Struts components, we will continue by showing you ways to get the most out of the framework. First, Struts recommends that you associate every JSP object withan ActionForm, which encapsulates data represented in the screen. You access the form data in the JSP object using accessory methods found in ActionForm. Listing 1 shows the conventional use of ActionForm tag in the View layer.Listing 1. Using ActionForm in JSP<html:form action="/bp1"><html:text property="attrib1" /></html:form >The ActionForm called "BP1AForm" includes the attribute attrib1, as well as its getter and setter methods. In the configuration file struts-config.xml, the action "/bp1" maps to bp1AForm using the name attribute. This facilitates data display in the JSP.To implement this best practice, Struts recommends you do two things:1. Create a JavaBean (BP1BForm) with attributes that form an attribute subsetin BP1AForm, along with the attributes' getter and setter methods.2. Replace the attributes in BP1AForm with the bean BP1BForm by associating the beanwith BP1AForm. Now you can access this attribute subsetin BP1AForm through BP1BForm. Listing 2 shows you how.Listing 2. Accessing form attributes in JSP<html:form action="/bp1"><bean:define name="bp1AForm" property="bp1BForm" id="bp1B"type="com.ibm.dw.webarch.struts.BP1BForm" /><html:text name="bp1B" property="subsetAtt1" /></html:form >Best Practice 2. Use Action class to handle requestsTypically when using the Struts framework, for every action the JSP component requests your application to execute, the application must extendStruts' org.apache.struts.action.Action to create an Action class. This individual Action class interfaces with the application's Model layer while processing the request.To implement this practice, Struts recommends you follow these steps:1. Create an Action class, say BP2Action, byextending org.apache.struts.action.Action.2. Create all other Action classes in your Web application by extending BP2Action.3. In BP2Action, create a method performTask(), as in publicabstract ActionForward performTask(ActionMappingmapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException.4. In BP2Action add one or more generic methods to the application, forexample serverSideValidate(). You can decide on the method's accessmodifier by considering the following factors:o If all Action classes must implement this method, make it abstract.o If some Action classes will provide a case-specific implementation, declare the method protected and give it a default implementation.5. In BP2Action, declare method perform() as final. Invoke the above genericmethod, which must always be called before processing the request. Now call themethod performTask() created in step 3.6. In every Action class extending BP2Action, addmethod performTask() with a case-specific implementation.AdvantagesThis practice has two main advantages. First, it helps you avoid redundant code inevery Action class of your Web application. Second, it gives the application more control over generic tasks by centralizing the behavior in one Action class.Best Practice 3. Use ActionForm to work on session dataIn a Struts-based Web application,each ActionForm extends org.apache.struts.action.ActionForm. These ActionForm s encapsulate page data and provide a validation framework to validate request parameters.Most Web applications maintain data in session to make them available throughout the application. This best practice addresses this Web application feature. It allowsmethods toSession() and fromSession() to move session data to and from the form data. Thus, it addresses session data maintenance in a Web application.To adhere to this practice, follow these steps:1. Create an abstract class named BP3Form byextending org.apache.struts.action.ActionForm.2. In BP3Form, add methods with access modifiers as in public abstract voidtoSession(SessionData sessionData) and voidfromSession(SessionData sessionData).3. In every ActionForm, extend BP3Form and implement the abstract methods inwhich the form data is transported to and from the session.4. The corresponding Action class may determine the order in which these methods arecalled. For example, you could invoke method toSession() onthe ActionForm just before actionForward is determined.When to use this practiceThis practice is most useful when session data is maintained as a single object and/or every page manipulates or uses session data.Best Practice 4. Handle exceptions effectivelyConventionally, when an application exception occurs in an Action class, the exception is first logged. Then the class creates an ActionError and stores it in the appropriate scope.This Action class then forwards control to the appropriate ActionForward. Listing 3 shows how Action class handles exceptions.Listing 3. Exception handling in an Action classtry {//Code in Action class}catch (ApplicationException e) {//log exceptionActionErrors actionErrors = new ActionErrors();ActionError actionError = new ActionError(e.getErrorCode());actionErrors.add(ActionErrors.GLOBAL_ERROR, actionError);saveErrors(request, actionErrors);}While conventional exception handling procedures save exception information inevery Action class, best practice 4 aims to avoid redundant code while handling exceptions.To use this practice, Struts recommends following these steps:1. Create an Action class, say BP4Action, byextending org.apache.struts.action.Action.2. Create all other Action classes in your Web application by extending BP4Action.3. In BP4Action, declare variable ActionErrors actionErrors = newActionErrors();.4. In BP4Action, create a method performTask() as in publicabstract ActionForward performTask(ActionMappingmapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, ActionErrorsactionErrors) throws IOException, ServletException.5. In BP4Action, declare method perform() as final. Then invoke generic methods,which must always be called before processing the request. Now you can call themethod performTask() created in the previous step.6. While implementing method performTask() in every Action class (byextending BP4Action), handle application exceptions as shown in Listing 4.Listing 4. Using ActionErrors effectivelytry {//Code in Action class}catch(ApplicationException appException) {//Log exception//Add error to actionErrorsactionErrors.add(ActionErrors.GLOBAL_ERROR,new ActionError(appException.getErrorCode()));}In BP4Action, after invoking the method performTask(), savethe ActionErrors using saveErrors(request, errors).AdvantagesThis practice's main advantage is that it avoids code redundancy in every Action class that handles ActionErrors.In conclusionBuilding an easily maintainable Web application can be one of the most challenging tasks for a development team. Using a mature framework like Struts helps you implement the infrastructure code normally associated with building an application. The Struts framework provides a set of standard interfaces for plugging business logic into the application, a consistent mechanism across development teams for performing tasks such as user data validation, screen navigation, and so forth, as well as aset of custom tag libraries to simplify developing screens.These four best practices are important for you to extract more from the framework's features. You, asa developer, can benefit from these lessons to increase your code modularity and application reusability, plus minimize code redundancy. These are all critical to building an extensible Web application.译文:Struts 开发的最佳实践Struts:简介Struts 是一种开源框架,可用来构建 Web 应用程序,它基于流行的Model-View-Controller (MVC2) 设计范型。

JSP应用框架论文中英文资料对照外文翻译文献综述

JSP应用框架论文中英文资料对照外文翻译文献综述

JSP应用框架中英文资料对照外文翻译文献综述JSP APPLICATION FRAMEWORKS1.1 WHAT ARE APPLICATION FRAMEWORKS:A framework is a reusable, semi-complete application that can be specialized to produce custom applications [Johnson]. Like people, software applications are more alike than they are different. They run on the same computers, expect input from the same devices, output to the same displays, and save data to the same hard disks. Developers working on conventional desktop applications are accustomed to toolkits and development environments that leverage the sameness between applications. Application frameworks build on this common ground to provide developers with a reusable structure that can serve as the foundation for their own products.A framework provides developers with a set of backbone components that have the following characteristics:Frameworks are the classic build-versus-buy proposition. If you build it, you will understand it when you are done—but how long will it be before you can roll your own? If you buy it, you will have to climb the learning curve—and how long is that going to take? There is no right answer here, but most observers would agree that frameworks such as Struts provide a significant return on investment compared to starting from scratch, especially for larger projects.1.2 OTHER TYPES OF FRAMEWORKS:The idea of a framework applies not only to applications but to application components as well. Throughout this article, we introduce other types of frameworks that you can use with Struts. These include the Lucene search engine, the Scaffold toolkit, the Struts validator, and the Tiles tag library. Like application frameworks, these tools provide semi-complete versions of a subsystem that can be specialized to provide a custom component.Some frameworks have been linked to a proprietary development environment. This is not the case with Struts or any of the other frameworks shown in this book. You can use anydevelopment environment with Struts: Visual Age for Java, JBuilder, Eclipse, Emacs, and Textpad are all popular choices among Struts developers. If you can use it with Java, you can use it with Struts.1.3 ENABLING TECHNOLPGIES:Applications developed with Struts are based on a number of enabling technologies. These components are not specific to Struts and underlie every Java web application. A reason that developers use frameworks like Struts is to hide the nasty details behind acronyms like HTTP, CGI, and JSP. As a Struts developer, you don’t need to be an alphabet soup guru, but a working knowledge of these base technologies can help you devise creative solutions to tricky problems.1.4 HYPERTEXT TRANSFER PROTOCOL (HTTP):When mediating talks between nations, diplomats often follow a formal protocol.Diplomatic protocols are designed to avoid misunderstandings and to keep negotiations from breaking down. In a similar vein, when computers need to talk, they also follow a formal protocol. The protocol defines how data is transmitted and how to decode it once it arrives. Web applications use the Hypertext Transfer Protocol (HTTP) to move data between the browser running on your computer and the application running on the server.Many server applications communicate using protocols other than HTTP. Some of these maintain an ongoing connection between the computers. The application server knows exactly who is connected at all times and can tell when a connection is dropped. Because they know the state of each connection and the identity of each person using it, these are known as stateful protocols.By contrast, HTTP is known as a stateless protocol. An HTTP server will accept any request from any client and will always provide some type of response, even if the response is just to say no. Without the overhead of negotiating and retaining a connection, stateless protocols can handle a large volume of requests. This is one reason why the Internet has been able to scale to millions of computers.Another reason HTTP has become the universal standard is its simplicity. An HTTP request looks like an ordinary text document. This has made it easy for applications to make HTTP requests. You can even send an HTTP request by hand using a standard utility such as Telnet. When the HTTP response comes back, it is also in plain text that developers can read.The first line in the HTTP request contains the method, followed by the location of the requested resource and the version of HTTP. Zero or more HTTP request headers follow the initial line. The HTTP headers provide additional information to the server. This can include the browser type and version, acceptable document types, and the browser’s cookies, just toname a few. Of the seven request methods, GET and POST are by far the most popular.Once the server has received and serviced the request, it will issue an HTTP response. The first line in the response is called the status line and carries the HTTP protocol version, a numeric status, and a brief description of the status. Following the status line, the server will return a set of HTTP response headers that work in a way similar to the request headers.As we mentioned, HTTP does not preserve state information between requests. The server logs the request, sends the response, and goes blissfully on to the next request. While simple and efficient, a stateless protocol is problematic for dynamic applications that need to keep track of their users.Cookies and URL rewriting are two common ways to keep track of users between requests. A cookie is a special packet of information on the user’s computer. URL rewriting stores a special reference in the page address that a Java server can use to track users. Both approaches are seamless, and using either means extra work when developing a web application. On its own, a standard HTTP web server does not traffic in dynamic content. It mainly uses the request to locate a file and then returns that file in the response. The file is typically formatted using Hypertext Markup Language (HTML) [W3C, HTML] that the web browser can format and display. The HTML page often includes hypertext links to other web pages and may display any number of other goodies, such as images and videos. The user clicks a link to make another request, and the process begins a new.Standard web servers handle static content and images quite well but need a helping hand to provide users with a customized, dynamic response.DEFINITION: Static content on the Web comes directly from text or data files, like HTML or JPEG files. These files might be changed from time to time, but they are not altered automatically when requested by a web browser. Dynamic content, on the other hand, is generated on the fly, typically in response to an individualized request from a browser.1.5 COMMON GATEWAY INTERFACE (CGI):The first widely used standard for producing dynamic content was the Common Gateway Interface (CGI). CGI uses standard operating system features, such as environment variables and standard input and output, to create a bridge, or gateway, between the web server and other applications on the host machine. The other applications can look at the request sent to them by the web server and create a customized response.When a web server receives a request that’s intended for a CGI program, it runs that program and provides the program with information from the incoming request. The CGI program runs and sends its output back to the server. The web server then relays the response to the browser.CGI defines a set of conventions regarding what information it will pass as environment variables and how it expects standard input and output to be used. Like HTTP, CGI is flexible and easy to implement, and a great number of CGI-aware programs have been written.The main drawback to CGI is that it must run a new copy of the CGI-aware program for each request. This is a relatively expensive process that can bog down high-volume sites where thousands of requests are serviced per minute. Another drawback is that CGI programs tend to be platform dependent. A CGI program written for one operating system may not run on another.1.6 JA V A SERVLETS:Sun’s Java Servlet platform directly addresses the two main drawbacks of CGI programs. First, servlets offer better performance and utilization of resources than conventional CGI programs. Second, the write-once, run-anywhere nature of Java means that servlets are portable between operating systems that have a Java Virtual Machine (JVM).A Servlet looks and feels like a miniature web server. It receives a request and renders a response. But, unlike conventional web servers, the Servlet application programming interface (API) is specifically designed to help Java developers create dynamic applications.The Servlet itself is simply a Java class that has been compiled into byte code, like any other Java object. The Servlet has access to a rich API of HTTP-specific services, but it is still just another Java object running in an application and can leverage all your other Java assets.To give conventional web servers access to servlets, the servlets are plugged into containers. The Servlet container is attached to the web server. Each Servlet can declare what URL patterns it would like to handle. When a request matching a registered pattern arrives, the web server passes the request to the container, and the container invokes the Servlet.But unlike CGI programs, a new Servlet is not created for each request. Once the container instantiates the Servlet, it will just create a new thread for each request. Java threads are much less expensive than the server processes used by CGI programs. Once the Servlet has been created, using it for additional requests incurs very little overhead. Servlet developers can use the init () method to hold references to expensive resources, such as database connections or EJB Home Interfaces, so that they can be shared between requests. Acquiring resources like these can take several seconds—which is longer than many surfers are willing to wait.The other edge of the sword is that, since servlets are multithreaded, Servlet developers must take special care to be sure their servlets are thread-safe.1.7 JA V ASERVER PAGES:While Java servlets are a big step up from CGI programs, they are not a panacea. Togenerate the response, developers are still stuck with using println statements to render the HTML. Code that looks like:out.println("<P>One line of HTML.</P>");out.println("<P>Another line of HTML.</P>");It is all too common in servlets that generate the HTTP response. There are libraries that can help you generate HTML, but as applications grow more complex, Java developers end up being cast into the role of HTML page designers. Meanwhile, given the choice, most project managers prefer to divide development teams into specialized groups. They like HTML designers to be working on the presentation while Java engineers sweat the business logic. Using servlets alone encourages mixing markup with business logic, making it difficult for team members to specialize.To solve this problem, Sun turned to the idea of using server pages to combine scripting and templating technologies into a single component. To build Java Server Pages, developers start by creating HTML pages in the same old way, using the same old HTML syntax. To bring dynamic content into the page, the developer can also place JSP scripting elements on the page. Scripting elements are tags that encapsulate logic that is recognized by the JSP. You can easily pick out scripting elements on JSP pages by looking for code that begins with <% and ends with %>.To be seen as a JSP page, the file just needs to be saved with an extension of jsp.When a client requests the JSP page, the container translates the page into a source code file for a Java Servlet and compiles the source into a Java class file—just as you would do if you were writing a Servlet from scratch. At runtime, the container can also check the last modified date of the JSP file against the class file. If the JSP file has changed since it was last compiled, the container will retranslate and rebuild the page all over again.Project managers can now assign the presentation layer to HTML developers, who then pass on their work to Java developers to complete the business-logic portion. The important thing to remember is that a JSP page is really just a Servlet. Anything you can do with a Servlet, you can do with a JSP.1.8 JA V ABEANS:JavaBeans are Java classes which conform to a set of design patterns that make them easier to use with development tools and other components.DEFINITION: A JavaBean is a reusable software component written in Java. To qualify as a JavaBean, the class must be concrete and public, and have a non-argument constructor. JavaBeans expose internal fields as properties by providing public methods that follow a consistent design pattern. Knowing that the property names follow this pattern, other Javaclasses are able to use introspection to discover and manipulate JavaBean properties.The JavaBean design patterns provide access to the bean’s internal state through two flavors of methods: accessors are used to read a JavaBean’s state; mutators are us ed to change a JavaBean’s state.Mutators are always prefixed with lowercase token set followed by the property name. The first character in the property name must be uppercase. The return value is always void—mutators only change property values, they do not retrieve them. The mutator for a simple property takes only one parameter in its signature, which can be of any type. Mutators are often nicknamed setters after their prefix.The mutator method signature for a weight property of the type Double would be:public void setWeight(Double weight);A similar design pattern is used to create the accessor method signature. Accessor methods are always prefixed with the lowercase token get, followed by the property name. The first character in the property name must be uppercase. The return value will match the method parameter in the corresponding mutator. Accessors for simple properties cannot accept parameters in their method signature. Not surprisingly, accessors are often called getters.The accessor method signature for our weight property is:public Double getWeight();If the accessor returns a logical value, there is a variant pattern. Instead of using the lowercase token get, a logical property can use the prefix is, followed by the property name. The first character in the property name must be uppercase. The return value will always be a logical value—either boolean or Boolean. Logical accessors cannot accept parameters in their method signature.The boolean accessor method signature for an on property would be:public boolean isOn();The canonical method signatures play an important role when working with Java- Beans. Other components are able to use the Java Reflection API to discover a JavaBean’s properties by looking for methods prefixed by set, is, or get. If a component finds such a signature on a JavaBean, it knows that the method can be used to access or change the bean’s properties.Sun introduced JavaBeans to work with GUI components, but they are now used with every aspect of Java development, including web applications. When Sun engineers developed the JSP tag extension classes, they designed them to work with JavaBeans. The dynamic data for a page can be passed as a JavaBean, and the JSP tag can then use the bean’s properties to customize the output.JSP应用框架1.1 什么是应用框架:框架(framework)是可以被重用的一种半成品的应用程序,我们可以用它来制作专门的定制程序。

软件工程专业基于Hibernate和Struts的J2EE应用开发策略大学毕业论文外文文献翻译及原文

软件工程专业基于Hibernate和Struts的J2EE应用开发策略大学毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目:基于Hibernate和Struts的J2EE应用开发策略文献、资料英文题目:文献、资料来源:文献、资料发表(出版)日期:院(部):专业:班级:姓名:学号:指导教师:翻译日期: 2017.02.14咋一篇文章连个题目也没有啊???This text analysis the mechanism of Hibernate and Struts, put forward 1 kind EE according to the J2 of the Hibernate and the Struts application development strategy.In this kind of strategy, the model layer use a Hibernate realization and see diagram and controller to then use a Struts frame a realization.So can consumedly lower the development efficiency that the Ou of code match sex and exaltation system. The key word Hibernate, Struts, the MVC, hold out for long time a layer one preface along with the Java technique of gradual mature and perfect, Be establishment business enterprise class application of standard terrace, the J2 EE terrace got substantial of development.Several technique asked for help from to include in the J2 EE norm:Enterprise JavaBean(EJB), Java Servlets(Servlet), Java Server Pages(JSP), Java Message Service(JMS)...etc., development many application system.But, also appeared some problem in the tradition J2 the EE the application of the development the process:1)the antinomy of of data model and logic model.Currently the database of usage basically and all is relation type database, but the Java be essentially a kind of the language which face to object, object at saving with read usage SQL and JDBC carry on a database operation and lowered plait distance of efficiency and system of can maintenance;2)tradition of J2 EE application much the adoption is according to the EJB heavy weight frame, this kind of frame suitable for develop a large business enterprise application, but usage the EJB container carry on development and adjust to try to need to be waste a great deal of time.For lowering the Ou of code to match sex, exaltation system of development efficiency, this text put forward 1 kind EE according to the J2 of the Struts frame and the Hibernate frame application development strategy. 2 datas' holding out for long time layer and Hibernate is one piece according to hold out for long time layer frame, is a kind of realization object and relationof the tool which reflect to shoot(O/R Mapping), it carried on the object of the lightweight to pack to the JDBC and make procedure member can usage object plait distance thought to operation database.It not only provided to shoot from Java to reflect of data form, but also provided a data a search and instauration mechanism.Opposite in usage JDBC and SQL to operation database, use a Hibernate ability consumedly of exaltation realization of efficiency.The Hibernate frame use allocation document of the form come to the reflect of the definition Java object and data form to shoot relation, in the meantime at more deep of level of data form of relation explanation for the relations such as inherit of and containment etc. of Java object.Pass the usage HQL language sentence complications of relation the calculate way use the way of object description, to a large extent simplification logarithms according to of search, speed development of efficiency.Have in the Hibernate a simple but keep the API of view, used for to the database mean of object performance search.Want to establish or the modification be these objects, need in the procedure carry on with them to hand over with each other, then tell Hibernate to keep.So, a great deal of pack hold out for long time turn operation of business logic no longer demand write a trivial JDBC language sentence, make data last long thus the layer got biggest of simplification.3 use the Struts realization MVC structure MVC(Model-View-Controller) is put forward by the Trygve Reenskaug, first drive application in the environment SmallTalk-80, is many to hand over with each other with interface system of constitute foundation.According to the need of variable of the interface design, MVC hand over with each other constitute of system to resolve into model and see diagram, controller three part. Model(Model) is software processing problem logic at independence in outside manifestation undercontents and form circumstance of inside abstract, packed the core data, logic of problem and function of calculation relation, independence in concrete of interface expression and I/O operation.See diagram(View) mean information and particular form demonstration of model data and logic relation and appearance to the customer.It acquire a manifestation information from the model, there can be many for homology of information dissimilarity of manifestation form or see diagram.Thecontroller(Controller) is a processing the customer hand over with software with each other operation of, its job is control provide model in any variety of dissemination, insure a customer interface among the model of rightness should contact;It accept a customer of importation, give° the importation feedback model, then realization compute model control, is make model and see diagram to moderate work of ually 1 see a diagram rightness should a controller.Model, see separate of diagram and controller, make a model be able to have many manifestation to see diagram.If the customer pass a certain see the controller of diagram change the data of model, all other dependence in these see of data diagram all should reflection arrive these variety.When therefore and regardless occurrence what data variety, controller all would variety notice allly see diagram, cause manifestation of renewal.This is actually a kind of variety of model-dissemination mechanism.The Struts frame is to be the item of Apache Jakarta to constitute part to publish luck to do at the earliest stage, it inheritted MVC of each item characteristic, and did according to the characteristics of J2 EE correspond of variety with expand.The Struts frame was good to combine Jsp, Java Servlet, Java Bean, Taglib etc. technique.In the Struts, what to undertake the controller role in the MVC be an ActionServlet.The ActionServlet is an in general use control module.This control module provided a processing all HTTPclaim which send out Struts of entrance point.Its interception with distribute these claim to arrive correspond of action type.(these action all of type is Action son type)Moreover the control module is also responsible for using to correspond of claim the parameter fill Action Form(FromBean), and pass action type(ActionBean).Action type the business logic of the interview core, then interview Java Bean or adjust to use EJB.End action type control the power pass follow-up of JSP document, from JSP document born see diagram.All these control logic make use of Struts-config.xml the document come to allocation.See diagram in the Struts frame main from JSP born page completion, the Struts provide abundant of JSP label database, this is advantageous to separating performance logic and procedure logic.The model is with 1 or the form existence of several Java Bean.In the Struts, main existence three kinds of Bean, respectively BE:Action, ActionForm, EJB perhaps Java Bean. The Struts frame have no concrete definition model layer of realization, in actually the development, model layer usually is close with business logic connect with each other, and want to carry on operation to the first floor data.The underneath's introduction is a kind of development strategy, lead the Hibernate into the model layer of Struts frame, usage it to carry on a data to pack with reflect to shoot, provide hold out for long time turn of support. 4 usage Hibernate and the Struts development J2 EE application 4.1 system structure diagram 3 manifestation according to Hibernate and Struts development strategy of system structure diagram.4.2 Development practice underneath combine a development practice, with in the J2 the EE the application very widespread customer register process for example, elucidation above-mentioned system structure is how concrete usage.The process of register is very clear:Customer from register page login.jsp importation register information, system to register theinformation carry on verification, if exactitude success register, otherwise hint correspond mistake information. In the development process, the usage Eclipse be used as development environment and added to carry to provide to the Struts and the Hibernate in the meantime better control and support of three square plug-in MyEclipse, Web server usage Tomcat, the database chose to use Mysql. Carry on an allocation to the Hibernate first, need to the system auto the born hibernate.cfg.xml carry on modification, allocation good database conjunction of various parameter and definition the data reflect to shoot a document.Because the Hibernate take of conjunction pond main used for test, the function isn't very good, can pass JNDI will it modification is usage Tomcat of conjunction pond.本文分析了Hibernate和Struts的机制,提出了一种基于Hibernate和Struts的J2EE 应用开发策略。

外文资料翻译---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,一种开放源码“模型-视图-控制器”框架,通过帮助解决所有这些问题,从而使开发人员的工作更为轻松。

MVC开放源码中英文对照外文翻译文献

MVC开放源码中英文对照外文翻译文献

中英文对照外文翻译文献(文档含英文原文和中文翻译)原文:Struts——an open-source MVC implementationThis 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.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 the problem into three categories:∙ModelThe model contains the core of the application'sfunctionality. The model encapsulates the state of theapplication. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.∙ViewThe 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. Figure 4 displays the Web adaptation of MVC, also commonly known as MVC Model 2 or MVC 2.Struts detailsThe ActionServlet classDo you remember the days of function mappings? You would map some input event to a pointer to a function. If you where slick, you would place the configuration information into a file and load the file at run time. Function pointer arrays were the good old days of structured programming in C.Life is better now that we have Java technology, XML, J2EE, and all that. The Struts Controller is a servlet that maps events (an event generally being an HTTP post) to classes. And guess what -- the Controller uses a configuration file so you don_t have to hard-code the values. Life changes, but stays the same. ActionServlet is the Command part of the MVC implementation and is the core of the Framework. ActionServlet (Command) creates and uses Action, an ActionForm, and ActionForward. As mentioned earlier, the struts-config.xml file configures the Command. During the creation of the Web project, Action and ActionForm are extended to solve the specific problem space. The file struts-config.xml instructs ActionServlet on how to use the extended classes. There are several advantages to this approach:The entire logical flow of the application is in a hierarchical text file. This makes it easier to view andunderstand, especially with large applications.∙The page designer does not have to wade through Java code to understand the flow of the 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 an abstract class that is sub-classed for each input form model. When I say input form model, I am 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, theStruts 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.Validation 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 dreadfulrequest.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 andActionErrors. 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.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——MVC 的一种开放源码实现本文介绍 Struts,它是使用 servlet 和 JavaServer Pages 技术的一种 Model-View-Controller 实现。

Jsp最佳实践外文文献翻译、中英文翻译、外文翻译

Jsp最佳实践外文文献翻译、中英文翻译、外文翻译

JSP best practicesJavaServer Pages (JSPs) technology is an extension of Java servlet technology and combines HTML and Java code into a single file. While Java servlet technology focuses on Java classes capable of generating HTML output with PrintWriter.println() statements, JSP technology abstracts this concept to a higher level. With JavaServer Pages, a Web developer can write static HTML pages and simply add Java code in those sections of the page that need to be dynamically generated. While this flexibility enables rapid development of simple Web applications, it can be abused, resulting in unnecessarily complex applications that are difficult to maintain, reuse, and enhance.To avoid needlessly complex applications, follow the practices I present in this article:1. Separate HTML from Java2. Place business logic in JavaBeans3. Factor general behavior out of custom tag handler classes4. Favor HTML in Java handler classes over Java in JSPs5. Use an appropriate inclusion mechanism6. Use a JSP template mechanism7. Use stylesheets8. Use the MVC pattern9. Use available custom tag libraries10. Use JSP comments in most cases11. Follow HTML best practices12. Utilize the JSP exception mechanismThese tips will help you write JSPs that are reusable and easy to maintain.(1)Separate HTML from JavaIt can be tempting to throw all Java and HTML code necessary for a Webpage into a single JSP file. In simple system development, such an approach makes it easy for someone new to the system to locate all relevant code in one place and understand how itall interacts. However, this approach becomes burdensome and costly when the application grows more complex and more developers become involved.Combining HTML and Java in the same source code can make the code significantly less readable. To enhance software readability, developers often use indentation; but mixing HTML and Java scriptlets in the same file can make useful indentation extremely difficult to maintain.Many Web development methodologies and architectures now emphasize the separation of HTML from Java code so different developers can focus on their strengths. Properly separating Java and HTML, including HTML-like JSP tags and custom tags, allows Web designers and HTML coders to work on the HTML (presentation) aspects, while Java developers work on the application′s Java (processing logic) portions. Java developers focus on business logic as they implement the behavior behind the custom tags; Web designers then use these custom tags just as they use ordinary HTML tags.(2)Place business logic in JavaBeansJava code included directly inside a JSP is not as readily accessible to other JSPs as Java code contained within a JavaBean. Common behavior and business logic placed in JavaBeans can not only be used by other JSPs but also by other portions of the application. That is because JavaBeans are merely Java classes that satisfy some basic conventions (such as a constructor with no arguments and public get/set methods for private data members) and can be used as any other Java class. Note that Enterprise JavaBeans (EJBs) are also useful for storing behaviors and data common to all components of the application.(3)Factor general behavior out of custom tag handler classesJava classes known as custom tag handlers implement custom tags. Unlike JavaBeans, custom tag handler classes are not readily used like ordinary Java utility classes. Instead, custom tag handler classes implement specific interfaces -- or extend classes that provide these interfaces′basic implementations. Because they are not readily reused outside JSPs, custom tag handlers should contain only specific behavior that would not be useful outside that custom tag -- that is, outside the JSP. Custom tags often require support for common behaviors or business logic and can utilize JavaBeans or EJBs that perform those common behaviors.(4)Favor HTML in Java handler classes over Java in JSPsSometimes cleanly separating HTML, JSP tags, and HTML-like custom tags from Java requires unnecessarily convoluted code. In these cases, you either include Java scriptlets and expressions in the JSP or put some HTML code in the Java tag handler class.I′d rather see a small amount of HTML code in the Java class than see Java, such as scriptlets and expressions, in the JSP. Since custom tag handlers are specific to the custom tags they implement (and not reusable outside JSPs), placing necessary HTML there is not troublesome. Sun′s Java 2 Platform, Enterprise Edition (J2EE) Blueprints documentation discusses this issue further.(5)Use an appropriate inclusion mechanismIt is rarely good design to reproduce code commonly used by different application pieces each time another piece of that application needs that functionality. Factoring common JSP or HTML code out of multiple pages and into a single file improves maintainability (you need to make changes in only one location) and reusability.Two JSP include mechanisms reduce code redundancy and promote reusability; to ensure that you use the appropriate include mechanism, it is important to know the differences between the two. Generally, I use the include directive unless I can justify a need for the include action. Question 7 in the Blueprints′"Web Tier" section provides a good resource for understanding the differences between the two include mechanisms and determining which to use in a particular situation.(6)Use a JSP template mechanismA template mechanism allows for a common file to control Webpage, or JSP, layout. Then, when you want to change the layout, you need to modify only one file, and all the other pages will reflect the layout change. This doesn′t just make for more maintainable code; using templates to control layout also makes Webpages more aesthetically pleasing to users who see consistent layouts for all an application′s pages.(7)Use stylesheetsJust as templates enable developers to place layout control in a single location, stylesheets enable developers to place appearance control in a single location. I use Cascading Style Sheets (CSS) to control such items as font families, font sizes, and table characteristics. Like templates, stylesheets allow the developer to make changes in onelocation; those changes immediately reflect on all appropriate pages, resulting in increased maintainability and consistent appearance to users.(8)Use the MVC patternWhile other design patterns can be used effectively with JSPs, I often use the Model-View-Controller (MVC) architecture with JSP technology. MVC enables the development of applications that are easier to create, test, maintain, and enhance. In JSP terminology, implementation of an MVC architecture is often referred to as Model 2 (from an early JSP specification). The J2EE Blueprints samples are based on MVC.(9)Use available custom tag librariesWhy should developers spend time reinventing the wheel and worrying about testing and debugging when custom tag libraries are readily available for many different purposes? Some vendors provide custom tag libraries to their customers for free or for individual purchase, but many custom tags can be found online. Resources provides a good starting point for locating potentially useful tag libraries.While these third-party custom tag libraries occasionally have bugs, most likely such problems will be discovered, since many developers use these libraries and test them in their own applications. Also, many custom tags are open source, so you can edit them to meet your needs.I find it well worth my time to keep informed of available custom tags, since these libraries often provide functionality common to most Web applications. While learning about available custom tag libraries requires a small time investment, reusing already-available custom tags saves the time of writing, testing, and debugging my own custom tags. As mentioned above, many tag libraries are also open source; in these cases,I can readily adapt general behavior to my specific project′s situation.(10)Use JSP comments in most casesAppropriate commenting seems to challenge software developers. JSPs, like other types of code, should include comments that describe complex or extraordinary functionality, the pages′purpose, and other general information typically commented out in source code.Since JSPs allow developers to intermix Java, JSP tags, and HTML tags in the same page, there are multiple ways to comment a JSP page. Developers should carefully consider which type of comment to employ in the page. HTML comments will beviewable in the compiled JSP′s HTML source code, and both major browsers make viewing this source easy. JSP comments, on the other hand, are not placed in the HTML document created by the JSP compilation process. These comments cannot be viewed as part of the page′s source through the browser, and they do not increase the size of the rendered page′s generated source. Java comments can also occur in a JSP inside Java scriptlet sections. These are not viewable in the browser either, but including Java comments in the JSP page violates the principle of separating Java from the HTML.Code comments are usually meant for developers who write and maintain code. Therefore, use JSP comments unless there is a compelling reason to have the comments display in the browser upon request.(11)Follow HTML best practicesWhen Java is factored out of the JSP and into JavaBeans and custom tag handlers, the JSP consists mostly of JSP tags, including custom tags, and HTML tags. To make the JSP easier to understand and maintain, follow best practices related to HTML development.(12)Utilize the JSP exception mechanismWhile a thrown exception′s stack trace proves extremely useful for developers when debugging their code, it is rarely desirable to share an entire exception stack trace with the software′s users. Lengthy stack traces are not aesthetically pleasing and can increase security risks by exposing information that does not need to be released. JSPs allow developers to catch and handle exceptions in the code, resulting in more secure and aesthetically pleasing exception handling. See Resources for details on the mechanics of JSP exception handling.Exception information is more useful if information besides the stack trace is included. JSPs can use session variables to store information about the current page and current operation being performed. Then, if an exception does occur, the exception page will be called; it will have access to both the thrown exception and the information about the original page that caused the exception. The exception page can utilize underlying Java code, in JavaBeans or EJBs, to store in the database the complete exception information, related session information, and the exception′s date and time.To reduce the unsightly error messages printed to the screen and improve security, the exception page need only print out a simple error message and perhaps an identifyingnumber that allows developers to locate more detailed exception information in the database. For aesthetic and security reasons, I prefer storing most of the exception information in a database or flat file rather than printing it all to the screen. Storing the exception information in a database or flat file also allows the information to be persisted even when a user exits the application. Note that during development you should print full exception information to the screen for regular testing and debugging.Jsp最佳实践Jsp技术是servlet技术的扩展,结合html、java代码于一个文件。

基于struts2的购物网站的设计与实现外文资料翻译

基于struts2的购物网站的设计与实现外文资料翻译

毕业设计(论文)外文资料翻译学院(系):计算机科学与技术学院专业:计算机科学与技术姓名:学号:外文出处: A Development FrameApplication Based on the Hibernate Application Based on the Hibernate、、the Struts and the Spring J2EE附件: 1. 1.外文资料翻译译文;外文资料翻译译文;外文资料翻译译文;2.2.2.外文原文。

外文原文。

指导教师评语:签名:年月日(用外文写用外文写) )附件1:外文资料翻译译文:外文资料翻译译文随着随着Java Java Java技术的逐渐成熟与完善技术的逐渐成熟与完善技术的逐渐成熟与完善,,作为建立企业级应用的标准平台作为建立企业级应用的标准平台,J2EE ,J2EE ,J2EE平台得到平台得到了长足的发展。

借助于了长足的发展。

借助于J2EE J2EE J2EE规范中包含的多项技术:规范中包含的多项技术:规范中包含的多项技术:Enterprise Enterprise JavaBean(EJB)JavaBean(EJB)、、Java Servlets(Servlet)Servlets(Servlet)、、Java Server Pages(JSP)Java Server Pages(JSP)、、Java Message Service(JMS)Java Message Service(JMS)等,开发等,开发出了许多应用系统。

但是,在传统出了许多应用系统。

但是,在传统J2EE J2EE J2EE应用的开发过程中也出现了一些问题:应用的开发过程中也出现了一些问题:应用的开发过程中也出现了一些问题:(1)(1)数据模型和逻辑模型之间的矛盾。

数据模型和逻辑模型之间的矛盾。

目前使用的数据库基本上都是关系型数据库,而Java Java本质上是一种面向对象的语言,对象在存储和读取时使用本质上是一种面向对象的语言,对象在存储和读取时使用本质上是一种面向对象的语言,对象在存储和读取时使用SQL SQL SQL和和JDBC JDBC进行数据库进行数据库操作,降低了编程的效率以及系统的可维护性;操作,降低了编程的效率以及系统的可维护性;(2)(2)传统的传统的传统的J2EE J2EE J2EE应用多采用基于应用多采用基于应用多采用基于EJB EJB EJB的重量级框架,的重量级框架,这种框架适合于开发大型企业应用,但是使用用,但是使用EJB EJB EJB容器进行开发和调试需要耗费大量时间。

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。

MVC框架中英文对照外文翻译文献

MVC框架中英文对照外文翻译文献

中英文对照外文翻译文献(文档含英文原文和中文翻译)译文:Web 2.0下的Spring MVC框架摘要 - 当要建立丰富用户体验的WEB应用时,有大量的WED应用框架可以使用,却很少有该选择哪一种的指导。

WEB 2.0应用允许个体管理他们自己的在线网页,并能与其他在线用户和服务器共享。

这样分享需要访问控制器来实现。

然而,现有的访问控制器解决方案不是令人很满意。

因为在开放且由用户主导的WEB环境下,它满足不了用户的功能需求。

MVC框架是在所有的WEB开发框架中最受欢迎的。

模型-视图-控制器(MVC)是一种软件架构,如今被认为是一种体系结构在软件工程模式中使用。

该模式从用户界面(输入和演示)分离出了“领域逻辑”(基于用户的应用逻辑),它允许独立地开发,测试和维护每个分离的部分。

模型-视图-控制器(MVC)模型创建的应用分离为不同的层次应用,同时在每两者之间建立松散的耦合。

关键字 - Spring MVC, 结构, XStudio, SOA, 控制器I.绪论如何确切地定义一个网站为“WEB 2.0”的呢?关于这有着许多不同见解,使它很难精确地下一个确切的定论。

但当我们将所有的WEB开发框架过一遍之后它就会变得清晰了。

各种基于WEB开发的架构如下:●Ntier架构(Ntier Architecture)在软件工程中,多层架构(常被称为n-tier架构)是一种表示层,应用处理层和数据管理层在逻辑上分开处理的客户端-服务器架构。

例如,一个应用在用户与数据库之间使用中间件提供数据请求服务就用到了多层体系结构。

最为广泛应用的多层体系结构是三层架构。

N-tier 应用架构为开发者提供了用来创建了一个灵活且可复用的模型。

通过打破应用层次,开发者只需修改或添加一个特定的层,而不是要去重写一遍整个应用。

它需要有一个表示层,一个业务层或者数据访问层和一个数据层。

层(layer)和层(tier)之间的概念常常是可以互换的。

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

中英文对照外文翻译文献(文档含英文原文和中文翻译)Best practices for Struts developmentStruts: A brief introductionStruts, an open source framework you can use to build Web applications, is based on the popular Model-View-Controller (MVC2) design paradigm. The framework is built upon standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, and it provides flexible and extensiblecomponents. Struts implements the Controller layer in the form of ActionServlet and recommends building the View layer using JSP tag libraries. Struts also provides a wrapper around theModel layer through Action classes. Figure 1 illustrates the Struts framework based on theModel-View-Controller design.Figure 1. Struts and MVCOverview of Struts componentsFirst, we'll explain the Struts components in the context of best practices and the role each one plays in your Web application development.ActionEvery Action of your application extendsStruts' org.apache.struts.action.Action. These Action classes provide an interface to the application's Model layer, acting as a wrapper around the business logic.Each Action class must provide its case-specific implementation to the perform() method. The perform() method always returns a value of type ActionForward. ActionFormEvery ActionForm of your application extendsStruts' org.apache.struts.action.ActionForm. ActionForm s are simple JavaBeans that encapsulate and validate request parameters. To validate your request data, your ActionForm's validate() method must give a case-specific implementation. ActionForm s serve as a carrier of request data to the Action class. A JSP object combines with a respective ActionForm to form your application's View layer, where almost every form field of the JSP object maps to an attribute of the corresponding ActionForm. JSP custom tag librariesThe JSP custom tag libraries are a collection of actions presented as tags. This is a powerful feature of the JSP Specification 1.1; it allows you to separate presentation from other application tiers. The libraries are easy to use and you can read them in XML-like fashion. You can easily maintain the JSP components by minimizing the use of Java scriptlets in them. The JSP tags that Struts provides include HTML, logic, and bean tags.ActionErrorsYou use ActionError s to support exception handling. An ActionError traps and propagates an application exception to the View layer. Each one is a collectionof ActionError instances. ActionError s encapsulate error messages, whilethe </html:errors> in the Presentation layer renders all error messages inthe ActionError collection.Best Practice 1. Reuse data across multiple ActionFormsNow that you are familiar with the Struts components, we will continue by showing you ways to get the most out of the framework. First, Struts recommends that you associate every JSP object withan ActionForm, which encapsulates data represented in the screen. You access the form data in the JSP object using accessory methods found in ActionForm. Listing 1 shows the conventional use of ActionForm tag in the View layer.Listing 1. Using ActionForm in JSP<html:form action="/bp1"><html:text property="attrib1" /></html:form >The ActionForm called "BP1AForm" includes the attribute attrib1, as well as its getter and setter methods. In the configuration file struts-config.xml, the action "/bp1" maps to bp1AForm using the name attribute. This facilitates data display in the JSP.To implement this best practice, Struts recommends you do two things:1. Create a JavaBean (BP1BForm) with attributes that form an attribute subsetin BP1AForm, along with the attributes' getter and setter methods.2. Replace the attributes in BP1AForm with the bean BP1BForm by associating the beanwith BP1AForm. Now you can access this attribute subsetin BP1AForm through BP1BForm. Listing 2 shows you how.Listing 2. Accessing form attributes in JSP<html:form action="/bp1"><bean:define name="bp1AForm" property="bp1BForm" id="bp1B"type="com.ibm.dw.webarch.struts.BP1BForm" /><html:text name="bp1B" property="subsetAtt1" /></html:form >Best Practice 2. Use Action class to handle requestsTypically when using the Struts framework, for every action the JSP component requests your application to execute, the application must extendStruts' org.apache.struts.action.Action to create an Action class. This individual Action class interfaces with the application's Model layer while processing the request.To implement this practice, Struts recommends you follow these steps:1. Create an Action class, say BP2Action, byextending org.apache.struts.action.Action.2. Create all other Action classes in your Web application by extending BP2Action.3. In BP2Action, create a method performTask(), as in publicabstract ActionForward performTask(ActionMappingmapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException.4. In BP2Action add one or more generic methods to the application, forexample serverSideValidate(). You can decide on the method's accessmodifier by considering the following factors:o If all Action classes must implement this method, make it abstract.o If some Action classes will provide a case-specific implementation, declare the method protected and give it a default implementation.5. In BP2Action, declare method perform() as final. Invoke the above genericmethod, which must always be called before processing the request. Now call themethod performTask() created in step 3.6. In every Action class extending BP2Action, addmethod performTask() with a case-specific implementation.AdvantagesThis practice has two main advantages. First, it helps you avoid redundant code inevery Action class of your Web application. Second, it gives the application more control over generic tasks by centralizing the behavior in one Action class.Best Practice 3. Use ActionForm to work on session dataIn a Struts-based Web application,each ActionForm extends org.apache.struts.action.ActionForm. These ActionForm s encapsulate page data and provide a validation framework to validate request parameters.Most Web applications maintain data in session to make them available throughout the application. This best practice addresses this Web application feature. It allowsmethods toSession() and fromSession() to move session data to and from the form data. Thus, it addresses session data maintenance in a Web application.To adhere to this practice, follow these steps:1. Create an abstract class named BP3Form byextending org.apache.struts.action.ActionForm.2. In BP3Form, add methods with access modifiers as in public abstract voidtoSession(SessionData sessionData) and voidfromSession(SessionData sessionData).3. In every ActionForm, extend BP3Form and implement the abstract methods inwhich the form data is transported to and from the session.4. The corresponding Action class may determine the order in which these methods arecalled. For example, you could invoke method toSession() onthe ActionForm just before actionForward is determined.When to use this practiceThis practice is most useful when session data is maintained as a single object and/or every page manipulates or uses session data.Best Practice 4. Handle exceptions effectivelyConventionally, when an application exception occurs in an Action class, the exception is first logged. Then the class creates an ActionError and stores it in the appropriate scope.This Action class then forwards control to the appropriate ActionForward. Listing 3 shows how Action class handles exceptions.Listing 3. Exception handling in an Action classtry {//Code in Action class}catch (ApplicationException e) {//log exceptionActionErrors actionErrors = new ActionErrors();ActionError actionError = new ActionError(e.getErrorCode());actionErrors.add(ActionErrors.GLOBAL_ERROR, actionError);saveErrors(request, actionErrors);}While conventional exception handling procedures save exception information inevery Action class, best practice 4 aims to avoid redundant code while handling exceptions.To use this practice, Struts recommends following these steps:1. Create an Action class, say BP4Action, byextending org.apache.struts.action.Action.2. Create all other Action classes in your Web application by extending BP4Action.3. In BP4Action, declare variable ActionErrors actionErrors = newActionErrors();.4. In BP4Action, create a method performTask() as in publicabstract ActionForward performTask(ActionMappingmapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, ActionErrorsactionErrors) throws IOException, ServletException.5. In BP4Action, declare method perform() as final. Then invoke generic methods,which must always be called before processing the request. Now you can call themethod performTask() created in the previous step.6. While implementing method performTask() in every Action class (byextending BP4Action), handle application exceptions as shown in Listing 4.Listing 4. Using ActionErrors effectivelytry {//Code in Action class}catch(ApplicationException appException) {//Log exception//Add error to actionErrorsactionErrors.add(ActionErrors.GLOBAL_ERROR,new ActionError(appException.getErrorCode()));}In BP4Action, after invoking the method performTask(), savethe ActionErrors using saveErrors(request, errors).AdvantagesThis practice's main advantage is that it avoids code redundancy in every Action class that handles ActionErrors.In conclusionBuilding an easily maintainable Web application can be one of the most challenging tasks for a development team. Using a mature framework like Struts helps you implement the infrastructure code normally associated with building an application. The Struts framework provides a set of standard interfaces for plugging business logic into the application, a consistent mechanism across development teams for performing tasks such as user data validation, screen navigation, and so forth, as well as aset of custom tag libraries to simplify developing screens.These four best practices are important for you to extract more from the framework's features. You, asa developer, can benefit from these lessons to increase your code modularity and application reusability, plus minimize code redundancy. These are all critical to building an extensible Web application.译文:Struts 开发的最佳实践Struts:简介Struts 是一种开源框架,可用来构建 Web 应用程序,它基于流行的Model-View-Controller (MVC2) 设计范型。

相关文档
最新文档