开发者

Struts2: custom action mapper defined in Spring

开发者 https://www.devze.com 2023-01-06 12:02 出处:网络
I have following situation: I use Struts2 as MVC cobtroller I use Spring as object factory I im开发者_JAVA百科plemented custom action mapper, I have configured this as a bean in my spring configurat

I have following situation:

  • I use Struts2 as MVC cobtroller
  • I use Spring as object factory
  • I im开发者_JAVA百科plemented custom action mapper, I have configured this as a bean in my spring configuration.

How can I tell Struts to use this bean as an action mapper?

I tried top set:

struts.mapper.class=beanName

in struts.properties but this doesn't work.


Do you have have following the struts.xml file ? This is required to tell Struts2 that objects will be created by Spring

<struts>
 <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    ... 
</struts>

OR

Add the following property in the struts.properties

struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory
0

精彩评论

暂无评论...
验证码 换一张
取 消