struts.xml显示有错,但是可以运行
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 动态方法调用 -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>
<constant name="struts.i18n.encoding" value="GBK"></constant>
<!-- 把struts2的action交给spring容器管理 -->
<constant name="struts.objectFactory" value="spring"></constant>
<package name="library" extends="struts-default">
<action name="login" class="login">
<result name="success" type="redirectAction">book!query</result> 这行有错
<result name="success1">/success.jsp</result>
<result name="fail">/login.jsp</result>
</action>
<action name="book" class="book">
<result name="success" type="redirectAction">book!query</result> 这行有错
<result name="success1">/success.jsp</result>
</action>
<action name="borrow" class="borrow">
<result name="success1" type="redirectAction">borrow!query</result> 这行有错
<result name="success">/list.jsp</result>
</action>
</package>
</struts> 展开
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 动态方法调用 -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>
<constant name="struts.i18n.encoding" value="GBK"></constant>
<!-- 把struts2的action交给spring容器管理 -->
<constant name="struts.objectFactory" value="spring"></constant>
<package name="library" extends="struts-default">
<action name="login" class="login">
<result name="success" type="redirectAction">book!query</result> 这行有错
<result name="success1">/success.jsp</result>
<result name="fail">/login.jsp</result>
</action>
<action name="book" class="book">
<result name="success" type="redirectAction">book!query</result> 这行有错
<result name="success1">/success.jsp</result>
</action>
<action name="borrow" class="borrow">
<result name="success1" type="redirectAction">borrow!query</result> 这行有错
<result name="success">/list.jsp</result>
</action>
</package>
</struts> 展开
展开全部
因为struts.xml中,<result></result>标签里边默认放的是*.jsp,就像你上边的代码中<result name="success1" type="redirectAction">borrow!query</result>,你的类型是redirectAction 重定向到另外一个Action(borrow),所以就会报错,但这只是struts的默认验证,没有编译错误,只要忽略这个验证就行了,忽略的方法:右键点击struts.xml文件,选择myeclipse,然后选择Exclude From Validation,就可以完全解决这个问题了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询