Scaffolding consists of single-pass generation of full or major portions of an application by applying standard application patterns from a minimal set of inputs provided by the developer. In some cases the scaffolded applications are used as-is, but in other cases the scaffolded artifacts are used as a starting point for additional customization by a developer. In either case scaffolding, originally popularized by the RAILS and GRAILS frameworks, is very effective at jump-starting application development. Spring MVC is a web framework from the creators of the Spring. While it isn't the only Spring-based web framework, it is one of the mostly commonly used web frameworks. This scaffolding tutorial is going to focus on generating a ready-to-run application based on the Spring MVC web framework. Since Spring MVC is just a web framework and the goal is to generate a ready-to-run application, the other layers of the application will also be scaffolded, including the service layer, data access layer, and in some cases even the domain layer.
Application Architecture: Spring MVC - Annotation-based Programming Model Spring MVC supports multiple approaches for implementing the web layer, and Spring 2.5 added support for an annotation-based programming model. The annotation-based approach has quickly become the predominant way of using Spring MVC, and it's generally regarded as the best practice in Spring MVC development. The scaffolding functions of MyEclipse for Spring will generate the web layer using the annotation-based programming model. What about other web technologies? This tutorial is focused on Spring MVC, but the scaffolding wizard can also generate the web layer implementation for Spring Web Flow, Adobe Flex, GWT and iPhone.
MyEclipse for Spring uses the Create-Read-Update-Delete (CRUD) application pattern for generating applications that allows the end-user to manage application data. While CRUD isn't the only application pattern, it's a fairly typical application pattern. While not all web applications are satisfied solely by the CRUD application pattern, developers find that the resulting generated application artifacts lend themselves to being easily re-used, customized and extended. CRUD applications are tied to an application domain model that is used as the input into the scaffolding engine. The domain model can exist in many forms, and the MyEclipse for Spring scaffolding functionality supports the use of Java beans, JPA entities, or database tables as inputs. This tutorial is going to walk you through producing a ready-to-run Spring MVC application that implements the CRUD application pattern for a domain model. MyEclipse for Spring will be used to generate the entire application within a matter of minutes that includes: A JPA entity corresponding to domain model (CUSTOMERS) A DAO for managing the JPA entity, Finder methods (JPA named queries) in the DAO based on domain model fields, A Service with fully implemented CRUD operations for managing domain model, A Controller with fully implemented request handlers for supporting web application, All the necessary Spring annotations and configuration files for a Spring MVC app, CRUD JSP pages using Spring Form tag library and JSTL Layout managed user interface using Sitemesh, Client-side validation implemented Spring JS with DOJO, CSS for UI styling JUnits for every Service and Controller, SpringSource certified code and configuration files, Generated code that follows Spring Recipes, The prerequisites needed to complete this tutorial are: It's now time to automatically generate all the necessary Java/Spring code and configuration files to implement the CRUD application. Right-click on the CustomersApp project, and choose MyEclipse > Scaffold CRUD application from...
The first step is to select the type of artifact you want to scaffold from. As mentioned in the introduction there are a variety of possible inputs into scaffolding. For this tutorial we're going to scaffold from a preexisting database table that comes with MyEclipse Derby database. Choose the Database Schema option on the Select Artifact Type(s) panel. Click the Next button.
The next step is to select the DB connection for accessing the MyEclipse Derby database. This panel will show you all configured DB connections in the MyEclipse workspace, and you must select the MyEclipse Derby connection, which is a preconfigured DB connection in MyEclipse. Click the Next button.
The next step is to select the desired schema and database table(s) that should be used for scaffolding. When the CLASSICCARS schema is selected the tables list will be populated with a list of all the available tables. The CUSTOMER table should be added to the scaffolding list. Click the Next button.
The next panel will prompt you to select parent objects, and this panel also lets you override the derived name of the Java Object that will be created from the database table. Since we're only scaffolding from a single database table, the Customer Java object must be the parent. For this tutorial there's nothing that needs to be changed on this panel. Just click the Next button.
Note: Java Object names are automatically derived from table names, but the name can be overridden by double-clicking on the name and typing a new name. The next step is to specify which layers of the application should be scaffolded and which package names should be used for each layer. All the layers are enabled by default. Enter org.customerapp as the base package. The package names for the different layers will be automatically derived from the base package. A sub-package (i.e. web, service, DAO, and domain) will be added to the end of the base package.
The next step is to specify which web clients should be generated for the web layer. As you can see, there are a variety of different web clients available, including Spring MVC, Spring Web Flow, Adobe Flex, GWT, and iPhone. This tutorial is focused on Spring MVC, so click on the Generate checkbox for Spring MVC.
The next step is in an optional step to customize the UI. For this tutorial we'll go with the defaults.
The final configuration step is to specify where the application (source code, configuration files, JSP, etc...) should be generated to. For this panel the defaults are fine. Click the Next button.
The final panel will give you a summary of everything that will be generated for you. Click the Finish button to scaffold the application from the information you provided in the wizard.
That's it. Once the wizard is complete you have a ready-to-run Spring MVC application that implements the CRUD application pattern for the domain model (CUSTOMERS DB table). Scaffold Spring DSL If you also want to scaffold Spring DSL artifacts for further maintenance and enhancement using Spring DSL Editors, then you should run the Add Spring Code Generation Capabilities wizard first, which will enable the Spring DSL for your project and add the Spring DSL view to your project. The scaffolding wizard will then add corresponding Spring DSL artifacts (model packages, controllers, services, etc...) for all scaffolded application components. You will see them all in the Spring DSL view of your project, and you can maintain and enhance the scaffolded artifacts using the Spring DSL and Spring Editors. To deploy the application, right-click on the CustomersApp project and select Run As --> MyEclipse Server Application.
MyEclipse Tomcat will start up. The first page will be a dashboard for accessing all scaffolded web clients. Since this tutorial only scaffolded a single database table for Spring MVC, the only option under Spring MVC is View Customers. Click on it to see generated Spring MVC application in operation.
The Spring MVC application can be used to (a) list all customers, (b) view a customer, (c) edit a customer, (d) delete customers and (e) add new customers. The following screen shots show some of the views.
Now that you have a running Spring MVC application, you may want re-run the tutorial and scaffold different web clients, including Spring Web Flow, Adobe Flex, GWT, and iPhone. You may also want to try the Spring Annotator and JAX-WS Annotator tutorials which are available in the Eclipse help system and online (see Additional Developer Resources). What was your experience with this tutorial? Share your experience with us by completing a very brief survey. Thank you for you interest in MyEclipse for Spring. If you are interested in learning more, the following developer resources are available: Developer Resources Reference - Eclipse Help (MyEclipse for Spring 8.6 --> MyEclipse for Spring Reference) or Education Materials (online) Tutorials - Eclipse Help (MyEclipse for Spring 8.6 --> Tutorials) or Education Materials (online) Screencasts - MyEclipse for Spring YouTube Channel (online) Support Forums - MyEclipse for Spring Forums (online) Blog - MyEclipse for Spring Posts (online)
发表评论
-
《算法之美》の字符串相关问题の壹
2012-07-06 09:52 723题目:编写一个单词逆序输出的算法,例如输入"SE ... -
WinForm下正则表达式的应用
2012-07-06 09:45 9361.引入命名空间:using System.Text.Re ... -
八个最常用的正则表达式
2012-07-06 09:38 712灵活的使用正则表达式,可以使得程序既简洁,又清晰。因为正则 ... -
基于表的Lua原生支持面向对象编程在GUI中的使用示例
2012-07-06 09:30 1138lua真的有很多神奇的用法,下面是一个基于表的形式实现的对 ... -
图片展示
2012-07-05 20:45 5955 ... -
Flex 4架构的组件开发
2012-07-03 13:44 600Flex 4架构的组件开发 作者:Michael Labr ... -
Flex利用自定义事件使用弹出窗口为DataGrid添加新数据
2012-07-02 12:27 629下面是TitleWindow所有代码: Xml代码 ... -
Flex右键菜单扫盲
2012-07-02 12:27 775怎么添加右键?在 Flex 中,只有应用程序中的顶层组件才 ... -
flex--LineChart
2012-07-02 12:27 624最近工作上用到了linechart,在网上查的资料还是非常 ... -
flex的mask处理
2012-07-02 12:26 760在做公司一个flash播放器时候,需要在一个swf中动态加 ... -
flex datechooser 日期小例子
2012-07-02 12:26 584在这个例子中,我们讲解的是DateChooser 控件,这 ... -
在应用中使用Ext Loader
2012-07-01 10:01 523原文:http://www.sencha.com/b ... -
广州工作2个月!差人的公司可以call我
2012-07-01 10:01 558网名:夜梦惊魂/夜枫设计 姓名:胡军 博客:http ... -
WebKit介绍及总结(一)
2012-07-01 10:01 653一. WebKit简介 ... -
基于push技术的web实时网络管理框架研究
2012-07-01 10:01 4351 引言 基于 web 的网络管理是web 功能和网 ... -
FLEX和Actionscript开发FLASH游戏8-2-1
2012-06-30 16:28 614FLEX和Actionscript开发FLASH游戏8-2-1 ... -
flex安全沙箱
2012-06-30 16:27 1056flex安全沙箱 2011年02月2 ... -
flex 联机游戏开发 - 五子棋游戏:(二)人性化选择
2012-06-30 16:27 590flex 联机游戏开发 - 五子棋游戏:(二)人性化选择 2 ...
相关推荐
MyEclipse for spring8.6 注册机 有效期到2017年
根据提供的文件信息,“myeclipse for spring 8.6”主要涉及的是MyEclipse这款集成开发环境(IDE)与Spring框架结合使用的版本介绍及相关知识点。接下来将从几个方面详细阐述这些知识点。 ### 一、MyEclipse简介 ...
MyEclipse For Spring 8.6.15
myeclipse for spring 8.6注册码
MyEclipse For Spring 8.6
MyEclipse For Spring 8.6.15
MyEclipse For Spring 8.6.10
MyEclipse For Spring 8.6.17
MyEclipse For Spring 8.6.10
MyEclipse For Spring 8.6.10
MyEclipse For Spring 8.6.17
MyEclipse For Spring 8.6.14
MyEclipse For Spring 8.6
了解和掌握"Myeclipse for Spring 8.6 注册码"的相关知识,对于充分利用MyEclipse的功能,特别是在Spring框架的开发环境中,至关重要。通过正确的获取和激活流程,开发人员可以享受全面的开发工具支持,从而提高生产...
标题 "myeclipse for spring 8.6 注册码 可用2年" 提到的是MyEclipse的一个特定版本——MyEclipse 8.6,它是一个集成开发环境(IDE),专为Spring框架提供支持。MyEclipse是Eclipse IDE的扩展,增加了对Java EE、Web...
### MyEclipse 8.6 for Spring:全面解析与下载指南 #### 一、MyEclipse 8.6概述 MyEclipse是一款功能强大的集成开发环境(Integrated Development Environment,简称IDE),尤其适用于Java应用程序和Web应用程序...
通过ide运行改程序,输入用户名后可生成key,用户名随意输入即可
使用myeclipse8.6ForSpring封装的注册机工具,直接java -jar 后输入一个注册名即可。
myeclipse spring 8.6 注册机,对8.6觉得有用,要用的朋友可以学习学习
MyEclipse For Spring 8.6.5