Unable to load configuration. - action - file:.../webapps/logonProject/WEB-INF/classes/struts.xml

今天学习struts2时碰到一个蛋疼的错误,提示无法加载struts.xml,



但是我的struts.xml只有很简单的一部分

<?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="com.test.action"  namespace="/">
		<action name="logon" class="com.test.action.LogonAction">
		 <result name="success">/ListToXml.jsp</result>
		</action>

	</package>

</struts>    
百度后,基本都是说要导入一些jar包什么的,可是我遇到的这个问题不是他们描述的那样。

然后我看到错误提示部分有这样一句话,说是parent package无法指定action-result 中的success,

再次百度后发现是由于我的struts.xml是自己写的,所以在package漏写了一句extends="struts-default" 

这个文件在struts-core-XX.jar中,好像是用来处理action-result部分的配置。

Caused by: No result type specified for result named 'success', perhaps the parent package does not specify the result type? - result - file:/D:/apache-tomcat-6.0.20/webapps/logonProject/WEB-INF/classes/struts.xml:6:27
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:612)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
	... 36 more

最后总结解决方案:在struts.xml的package配置中,加上一句 extends="struts-default"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值