ssh action 调用service的时候service 为null, 找了半天都没有找到哪里错了。
<bean id="userService" class="com.struts.serviceImpl.UserServiceImpl">
<property name="userDao">
<ref local="userDao"/>
</property>
</bean>
<bean id="userAction" class="com.struts.action.UserAction">
<property name="user">
<ref local="user"></ref>
</property>
<property name="userService">
<ref local="userService"/>
</property>
</bean>serviceactionssh
<bean id="userService" class="com.struts.serviceImpl.UserServiceImpl">
<property name="userDao">
<ref local="userDao"/>
</property>
</bean>
<bean id="userAction" class="com.struts.action.UserAction">
<property name="user">
<ref local="user"></ref>
</property>
<property name="userService">
<ref local="userService"/>
</property>
</bean>serviceactionssh
private UserServiceImpl userService;
public void setUserService(UserServiceImpl userService) {
this.userService = userService;
}
我生成的
1.你的成员变量和你配置的userService名称一样吗?
2.确定你的成员变量有set get方法