关于 struts2 Unable to load configuration. - action

时间:2021-11-10 12:01:20
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts> <package name="student" namespace="/student" extends="struts-default,json-default">
<action name="student_*" class="cn.edu.nwsuaf.action.StudentAction"
method="{1}">
<result name="init">/pages/student/student-edit.jsp</result>
<result name="update">/pages/student/student-list.jsp</result>
<result name="find">/pages/student/student-list.jsp</result>
<result name="delete">/pages/student/student-list.jsp</result>
<result name="add" type="json">
<param name="root">studentAdd</param>
</result>
</action>
</package> </struts>

因为没有继承json-default,导致再加入result type="json"属性时,启动tomcat控制台报错:Exception starting filter struts2 Unable to load configuration. - action

解决方法:

package extends要继承json-default