Example of Webwork2 and Springframework Integration (Original) (1)

xiaoxiao2021-03-06  96

1, create a J2EE project

(1) Development environment and configuration

l Development Environment and Configuration Refer to "Development Spring MVC Application (1)", basically the same, and also need:

l Webwork 2.1: You can download at http://www.opensymphony.com

l WebWork2-Spring.jar: Webwork2 and SpringFramework connector, please download here

(2) Creating WW2 projects

l File / New / Lomboz J2EE Project

l Project settings: Specify engineering name WW2

l Java settings: Note that the default output directory is bin, change to WW2 / WW2 / WEB-INF / CLASSES

l Create J2EE Module: Select the web modules page, click the Add button to specify the web module name WW2; select the TargeTed Serverse page, Type Select Apache Tomcat V5.0.x, click Add buttons to increase

l Click the finish button to complete the creation of the project.

(3) Import the required class library to WW2 / web-inf / lib directory

l Webwork-2.1.jar All JAR files under extreme lib / core directory

l Webwork2-spring.jar

l Spring.jar

(4) Import BUS and DB packages

l WebWork2 is mainly responsible for the control and processing of the web representation layer, independent of business logic layer and data persistence.

l This application reuses the business logic layer and data persistence of the SpringApp application, transforms its web representation, uses webwork2 to implement, please refer to "Development Spring MVC Application" series articles

l So, introduce BUS and DB packages in the SpringApp project to WW2 projects, directly use

l Since WebWork2 has its own data validity verification mechanism, the bus.priceincreasevalidator class needs to be

l In addition, the unit test portion is spoken here.

转载请注明原文地址:https://www.9cbs.com/read-123301.html

New Post(0)