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

xiaoxiao2021-03-06  98

2, Webwork2 and SpringFramework integration configuration

(1) WW2 / Web-INF / ApplicationContext.xml

l Since the web representation is implemented in the use of Spring MVC Framework, the BEAN configuration of the business logic layer and the data persistence component is moved from SpringApp-servlet.xml to ApplicationContext.xml.

"http://www.springframework.org/dtd/spring-beans.dtd">

com.mysql.jdbc.driver

jdbc: mysql: // localhost / test

test

test

(2) WW2 / Web-INF / Web.xml

l Add 2 context listeners in web.xml

Org.springframework.web.context.contextloaderListener

com.atlassian.xwork.ext.resolverSetupServletContextListener

(3) WW2 / Web-INF / CLASSES / XWORK.XML

ExternalReferenceRereSolver = "com.atlassian.xwork.ext.springservletContextReferenceRereSolver">

Class = "com.opensymphony.xwork.interceptor.externalReference" />

Class = "Web.SPRINGAPPACTION">

Prodman

/ web-inf / template / hello.vm

/ web-inf / jsp / hello.jsp

->

Class = "Web.PriceIncReaseform">

/ web-inf / template / priceIncrease.vm

/ web-inf / jsp / priceIncrease.jsp

->

Class = "Web.PriceInCreaseformAction">

Prodman

/ web-inf / template / priceIncrease.vm

/ web-inf / jsp / priceIncrease.jsp

->

SpringApp

l Xwork uses external references to use references in the Spring Bean configuration:

l Specify the external reference parser in the tag for com.atlassian.xwork.ext.springservletContextReferenceRereSolver

Interceptor l recombined stack to encompass com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor; Interceptor herein defined two stacks: externalStack and externalValidationWorkflowStack, the former is defined as a default reference Interceptor, the latter being required to verify the validity of the data reference Action L Finally, use the tag to reference the external Spring Bean in the action (Configuration of Action will be described later)

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

New Post(0)