Add the following sentence to struts. xml for spring to manage action
[Html]
<Struts>
<Constant name = "struts. objectFactory" value = "spring"/>
</Struts>
Next let's take a look at the action configuration in applicationContext. xml.
[Html]
<Bean id = "<span style =" color: # ff6666; "> registAction </span>"
Class = "org. arthur. lr. system. RegistAction">
<! -- SessionFactory reference required for dependency injection DAO component -->
<Property name = "mgr" ref = "umi">
</Property>
</Bean>
Then let's see how to apply this bean to struts. xml.
[Html]
<! -- In the class, registAction indicates a bean whose id is registAction in the spring configuration file. -->
<Action name = "<span style =" color: # ff0000; "> regist </span>" class = "<span style =" color: # ff6666; "> registAction </span>">
<Result>/success. jsp </result>
<Result name = "input">/regist. jsp </result>
<Result name = "failure">/regist. jsp </result>
</Action>
If you want to use ajax technology to send an action, the url is also written as the action name in the configuration file.
For example, $. post ("regist", {json: name}, callBack, "json ");
Author: chunqiuwei