计算机专业毕业设计外文翻译--Spring的web MVC 构架模式
《计算机专业毕业设计外文翻译--Spring的web MVC 构架模式》由会员分享,可在线阅读,更多相关《计算机专业毕业设计外文翻译--Spring的web MVC 构架模式(6页珍藏版)》请在毕设资料网上搜索。
1、Web MVC with the Spring Framework Juergen Hoeller 1. Introduction: Spring the Application Framework When first confronted with the Spring Framework, one might be tempted to think: Oh no, not yet another web framework. This article will outline why Spring isnt particularly a web framework but a gener
2、ic lightweight application framework with dedicated web support, and show the architectural differences to Struts and WebWork In contrast to Struts or WebWork, Spring is an application framework for all layers: It offers a bean configuration foundation, AOP support, a JDBC abstraction framework, abs
3、tract transaction support, etc. It is a very non-intrusive effort: Your application classes do not need to depend on any Spring classes if not necessary, and you can reuse every part on its own if you like to. From its very design, the framework encourages clean separation of tiers, most importantly
4、 web tier and business logic: e.g. the validation framework does not depend on web controllers. Major goals are reusability and testability: Unnecessary container or framework dependencies can be considered avoidable evils. Of course, Springs own web support is nicely integrated with the frameworks
5、general patterns. Nevertheless, replacing the web solution with Struts, WebWork, or the like is easy. Both with Springs web support or a different one, Spring allows for building a true dedicated middle tier in the web container, with the option to reuse exactly the same business logic in test envir
6、onments or standalone applications. And within J2EE, your business logic will not unnecessarily depend on container services like JTA or EJB - allowing complex, well-architected web applications to run in a simple container like Tomcat or Resin. Note that Spring doesnt generally aim to compete with
7、existing solutions. It rather fosters seamless integration with standards like Servlet, JSP, JTA, JNDI, JDBC, and JDO, and well-suited tools like Hibernate, Velocity, Log4J, and Cauchos Hessian/Burlap. The framework is designed to grow with the needs of your applications, in terms of technology choi
8、ce: For example, you will probably use JTA via Springs JtaTransactionManager if you need distributed transactions - but only then, as there are perfect replacements for single databases, like DataSourceTransactionManager or HibernateTransactionManager. 2. Web MVC: The Design of Springs Web Framework
9、 Springs web framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, and locale and theme resolution. The default handler is a very simple Controller interface, just offering a ModelAndView handleRequest(request,resp
10、onse) method. This can already be used for application controllers, but you will prefer the included implementation hierarchy, consisting of AbstractController, AbstractCommandController, MultiActionController, SimpleFormController, AbstractWizardFormController. Application controllers will typicall
11、y be subclasses of those. Note that you can choose an appropriate base class: If you dont have a form, you dont need a FormController. This is a major difference to Struts. You can take any object as command or form object: Theres no need to implement an interface or derive from a base class. Spring
12、s data binding is highly flexible, e.g. it treats type mismatches as validation errors that can be evaluated by the application, not as system errors. So you dont need to duplicate your business objects properties as Strings in your form objects, just to be able to handle invalid submissions, or to
13、convert the Strings properly. Instead, its often preferable to bind directly to your business objects. This is another major difference to Struts which is built around required base classes like Action and ActionForm - for every type of action. Compared to WebWork, Spring has more differentiated obj
14、ect roles: It supports the notion of a Controller, an optional command or form object, and a model that gets passed to the view. The model will normally include the command or form object but also arbitrary reference data. Instead, a WebWork Action combines all those roles into one single object. We
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 毕业设计 外文 翻译 spring web mvc 构架 模式
