我的ssh注册怎么老是提示空指针异常,this.userservice.save(users).这里提示异常<bean id="UsersDAO" class="com.ssh_demo.dao.impl.UsersDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="usersService" class="com.ssh_demo.service.impl.UsersService"
abstract="false" lazy-init="default"
autowire="default" dependency-check="default">
<property name="usersdaoinfo">
<ref bean="UsersDAO" />
</property>
</bean> <bean name="/save" class="com.ssh_demo.struts.action.SaveAction"
abstract="false" lazy-init="default"
autowire="default" dependency-check="default">
<property name="usersservice">
<ref bean="usersService" />
</property>
</bean>这是我的配置文件我不知道为什么会这样请大家帮忙了
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="usersService" class="com.ssh_demo.service.impl.UsersService"
abstract="false" lazy-init="default"
autowire="default" dependency-check="default">
<property name="usersdaoinfo">
<ref bean="UsersDAO" />
</property>
</bean> <bean name="/save" class="com.ssh_demo.struts.action.SaveAction"
abstract="false" lazy-init="default"
autowire="default" dependency-check="default">
<property name="usersservice">
<ref bean="usersService" />
</property>
</bean>这是我的配置文件我不知道为什么会这样请大家帮忙了
就是你的com.ssh_demo.struts.action.SaveAction没有成功注入userservice
<ref bean="usersService" />
</property>
是不是属性对不上,或同上
如果保存的时候出现null,可能是form中没有user对象,或属性未自动装配到user中,
还有一个可能,是不是Service方法里忘了写保存方法了。