看了黑马姜涛老师讲解的SSH整合,在
在这个图中很疑惑为什么不直接把Action交给Spring管理,直接注入Service即可
<bean name="CustomerAction" class="com.awf.sshIntegrate.web.action.CustomerAction">
<property name="CustomerService" ref="CustomerService"/>
</bean>
试了之后发现不能这么做,测试报错
19:11:21,885 ERROR DefaultDispatcherErrorHandler:42 - Exception occurred during processing request: null
java.lang.NullPointerException
at com.awf.sshIntegrate.web.action.CustomerAction.save(CustomerAction.java:37)
这是因为Action是由Struts获得请求后创建
若是直接以上述方式实现,就存在两个Action了,