基于hibernate和struts的选课排课系统毕业设计英文文献翻译.doc
《基于hibernate和struts的选课排课系统毕业设计英文文献翻译.doc》由会员分享,可在线阅读,更多相关《基于hibernate和struts的选课排课系统毕业设计英文文献翻译.doc(10页珍藏版)》请在三一文库上搜索。
1、毕业设计说明书英文文献及中文翻译学生姓名: 学号: 学 院: 专 业: 指导教师: 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 l
2、ike Java Servlets, JavaBeans, ResourceBundles, and XML, and it provides flexible and extensible components. Struts implements the Controller layer in the form ofActionServletand recommends building the View layer using JSP tag libraries. Struts also provides a wrapper around the Model layer throughA
3、ctionclasses. Figure 1 illustrates the Struts framework based on the Model-View-Controller design.Figure 1. Struts and MVCOverview of Struts components First, well explain the Struts components in the context of best practices and the role each one plays in your Web application development.ActionEve
4、ryActionof your application extends Strutsorg.apache.struts.action.Action. TheseActionclasses provide an interface to the applications Model layer, acting as a wrapper around the business logic. EachActionclass must provide its case-specific implementation to theperform()method. Theperform()method a
5、lways returns a value of typeActionForward.ActionFormEveryActionFormof your application extends Strutsorg.apache struts action ActionForm.ActionForms are simple JavaBeans that encapsulate and validate request parameters. To validate your request data, yourActionFormsvalidate()method must give a case
6、-specific implementation.ActionForms serve as a carrier of request data to theActionclass. A JSP object combines with a respectiveActionFormto form your applications View layer, where almost every form field of the JSP object maps to an attribute of the correspondingActionForm.JSP custom tag librari
7、esThe 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
8、 the JSP components by minimizing the use of Java scriptlets in them. The JSP tags that Struts provides include HTML, logic, and bean tags.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
9、 out of the framework. First, Struts recommends that you associate every JSP object with anActionForm, which encapsulates data represented in the screen. You access the form data in the JSP object using accessory methods found inActionForm. Listing 1 shows the conventional use ofAction Formtag in th
10、e View layer.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 extend Strutsorg apache struts.action.Actionto create anActionclass. This individualActionclass in
11、terfaces with the applications Model layer while processing the request.To implement this practice, Struts recommends you follow these steps:1. Create anActionclass, sayBP2Action, by extendingorg.apache.struts.action.Action.2. Create all otherActionclasses in your Web application by extendingBP2Acti
12、on.3. InBP2Action, create a methodperformTask(), as in public abstractActionForward performTask(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException.4. InBP2Actionadd one or more generic methods to the application, for
13、 exampleserverSideValidate(). You can decide on the methods access modifier by considering the following factors:o If allActionclasses must implement this method, make it abstract.o If someActionclasses will provide a case-specific implementation, declare the method protected and give it a default i
14、mplementation.5. InBP2Action, declare methodperform()as final. Invoke the above generic method, which must always be called before processing the request. Now call the methodperformTask()created instep 3.6. In everyActionclass extendingBP2Action, add methodperformTask()with a case-specific implement
15、ation.AdvantagesThis practice has two main advantages. First, it helps you avoid redundant code in everyActionclass of your Web application. Second, it gives the application more control over generic tasks by centralizing the behavior in oneActionclass.Best Practice 3. Use ActionForm to work on sess
16、ion dataMost Web applications maintain data in session to make them available throughout the application. This best practice addresses this Web application feature. It allows methodstoSession()andfromSession()to move session data to and from the form data. Thus, it addresses session data maintenance
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 hibernate struts 选课 系统 毕业设计 英文 文献 翻译
链接地址:https://www.31doc.com/p-5182241.html