struts配置问题
小弟最近遇到一件 极其郁闷的事 不废话 上代码<package name="student" extends="struts-default" namespace="/studentMange">
<action name="student" class="StudentAction">
<result name="success">/index.jsp</result>
<result name="updateSuccess">/student/frame/right.jsp</result>
<result name="stuScore">/student/score.jsp</result>
<result name="stuCourse">/student/course.jsp</result>
<result name="getCourse">/student/course_update.jsp</result>
<result name="getCourse2">/student/course_update.jsp</result>
</action>
</package>
<package name="check" extends="struts-default" namespace="/check">
<action name="check" class="CheckAction">
<result name="userCheckSuccess">/student/studentPage.jsp</result>
<result name="teacherCheckSuccess">/teacher/teacherPage.jsp</result>
<result name="fail">/index.jsp</result>
</action>
</package>
这样的配置checkAction中的service总是无法注入导致空指针错误有谁遇到和我一样的错误吗?
我spring配置文件是这样的应该没有问题
<bean id="CheckAction" class="com.sxt.action.CheckAction" scope="prototype">
<property name="checkService" ref="checkServiceImpl"></property>
</bean>
checkAction类的内容
public class CheckAction extends ActionSupport {
CheckService checkService;
//账号
private String stuId;
//密码
private String stuPwd;
//身份
private String role;
public void setCheckService(CheckService checkService) {
System.out.println("注入service");
this.checkService = checkService;
}
总是打印不出注入service这句话
web.xml的配置也是没错的
<!-- 指定spring配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<!-- 配置加载spring容器的易做图 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
--------------------编程问答-------------------- 你web.xml里面配置strust2的配置信息了么?你这里面怎么只有spring的 --------------------编程问答--------------------
+1 --------------------编程问答-------------------- 在struts.xml文件中有没有加<!-- struts2委托spring管理 -->
<constant name="struts.objectFactory" value="spring"/>
补充:Java , Java EE