{"id":4,"date":"2009-07-09T12:26:06","date_gmt":"2009-07-09T11:26:06","guid":{"rendered":"http:\/\/www.flamingpenguin.co.uk\/blog\/?p=4"},"modified":"2009-07-09T12:26:58","modified_gmt":"2009-07-09T11:26:58","slug":"struts2-and-spring-integration","status":"publish","type":"post","link":"https:\/\/www.flamingpenguin.co.uk\/blog\/2009\/07\/09\/struts2-and-spring-integration\/","title":{"rendered":"Struts2 and Spring Integration"},"content":{"rendered":"<p>It is possible to use Spring to create Struts2 actions. Here are some snippets which make it work.<\/p>\n<p>in your web.xml<\/p>\n<pre lang=\"xml\">   \r\n<listener>\r\n   <listener-class>\r\n      org.springframework.web.context.ContextLoaderListener\r\n   <\/listener-class>\r\n<\/listener>\r\n<filter>\r\n   <filter-name>struts2<\/filter-name>\r\n   <filter-class>\r\n      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter\r\n   <\/filter-class>\r\n<\/filter>\r\n<filter-mapping>\r\n   <filter-name>struts2<\/filter-name>\r\n   <url-pattern>\/*<\/url-pattern>\r\n<\/filter-mapping>\r\n<\/pre>\n<p>In your struts.xml<\/p>\n<pre lang=\"xml\">\r\n<constant name=\"struts.objectFactory\" value=\"spring\" \/>\r\n<\/pre>\n<p>In your pom.xml<\/p>\n<pre lang=\"xml\">\r\n<dependency>\r\n   <groupId>org.apache.struts<\/groupId>\r\n   <artifactId>struts2-core<\/artifactId>\r\n   <version>2.1.6<\/version>\r\n<\/dependency>\r\n<dependency>\r\n   <groupId>org.apache.struts<\/groupId>\r\n   <artifactId>struts2-spring-plugin<\/artifactId>\r\n   <version>2.1.6<\/version>\r\n<\/dependency>\r\n<dependency>\r\n   <groupId>org.springframework<\/groupId>\r\n   <artifactId>spring<\/artifactId>\r\n   <version>2.5.5<\/version>\r\n<\/dependency>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to use Spring to create Struts2 actions. Here are some snippets which make it work. in your web.xml org.springframework.web.context.ContextLoaderListener struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 \/* In your struts.xml In your pom.xml org.apache.struts struts2-core 2.1.6 org.apache.struts struts2-spring-plugin 2.1.6 org.springframework spring &hellip; <a href=\"https:\/\/www.flamingpenguin.co.uk\/blog\/2009\/07\/09\/struts2-and-spring-integration\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[3,6,5,4],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-java","tag-j2ee","tag-servlet","tag-spring","tag-struts2"],"_links":{"self":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/4","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=4"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}