Meet a person in the software group: Ask the big God a problem, in the SSH framework, the action in spring injection, start the service injected success, the action Run-time object to become null, this is how AH.
The problem: After looking at his profile, he found that he used spring's dependency injection Applictioncontext.xml has a related bean configured, but when you configure the action in a struts2 file, you use the full path of the class, not the bean that references spring.
Solution: The problem has been found, it is good to do, in the Struts2 configuration file to change the action class value to the appropriate bean.
As shown in the figure:
Key position of Applictioncontext.xml
Key position of Struts.xml
Modified into
<action name= "Login" class= "useraction" mentod= "Login" >
<result name= "Success" type= "redirect" >main.jsp</result>
<result name= "fail" type= "redirect" >pass.jsp</result>
</action>
Problem solving ....