原来的代码:
MailAction:
public class MailAction extends ActionSupport {
private SysuserinfoService sysuserinfoService;// 用户基本信息表
private String email;
private String errorMessage;
private String username;// 账户
set/get方法有的
struts.xml
<package name="mail" extends="commons">
<action name="mailSendMail" method="sendMail"
class="cn.edu.nwsuaf.comAction.MailAction">
<result name="success">/page/mail/success.jsp</result>
<result name="error">/page/mail/error.jsp</result>
<result name="input">/login.jsp</result>
</action>
</package>
application.xml
<bean id="SysuserinfoService" class="cn.edu.nwsuaf.Service.Impl.SysuserinfoService">
<property name="baseDao" ref="BaseDao"></property>
</bean>
<!-- 邮件 -->
<bean id="MailAction" class="cn.edu.nwsuaf.comAction.MailAction">
<property name="sysuserinfoService" ref="SysuserinfoService"></property>
</bean>
在经过一番查错和参考网上的解决方法,总结错误为:
是Struts2和Spring整合过程出了问题
struts.xml
<package name="mail" extends="commons">
<action name="mailSendMail" method="sendMail"
class="MailAction">
<result name="success">/page/mail/success.jsp</result>
<result name="error">/page/mail/error.jsp</result>
<result name="input">/login.jsp</result>
</action>
</package>
解决问题