xml异常

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<!-- 创建一个default包,继承自Struts 2的struts-default包 -->
<package name="default" namespace="/" extends="struts-default">
<!-- 接收处理用户的/helloWorld.action请求,并根据返回结果,完成跳转 -->
<default-action-ref name="index" />

<global-results>
<result name="error">/error.jsp</result>
</global-results>

<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="error" />
</global-exception-mappings>

<action name="index">
<result type="redirectAction">
<param name="actionName">HelloWorld</param>
<param name="namespace">/example</param>
</result>
</action>
</package>

<include file="example.xml" />

<!-- Add packages here -->

</struts>

错误提示:2016-1-25

The processing instruction target matching "[xX][mM][lL]" is not allowed.

可能原因:1.是空格的问题,把空格去掉就可以了

     2.可以是要求必须写在第一行

       3.<?xml version="1.0" encoding="UTF-8" ?>这句话有时候也区分大小写

解决方案:我自己是把<?xml version="1.0" encoding="UTF-8" ?>写到第一行,并且前面没有空格

 

posted @ 2016-01-25 21:56  米晨依依  阅读(162)  评论(0)    收藏  举报