Skip to main content

Posts

Showing posts from September 19, 2009

Struts 2 and springs Integration

In this simple hello world example you will see how to integrate Spring and Struts 2 using the struts2-spring-plugin. By doing this you can utilize the Spring's powerful Dependency Injection feature. To learn more about Dependency Injection refer this example. Step1: First add the org.springframework.web.context.ContextLoaderListener to the web.xml file. <?xml version="1.0" encoding="UTF-8"?> <web-app xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Struts2Example14</display-name> <!-- Context Configuration locations for Spring XML files --> <context-param> <param-name> contextConfigLocation </param-name> ...