java 根元素后面的标记文档必须格式良好
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2552010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
the markup document following the root element must be well formed
提问by Suresh Chaganti
I am getting the following error while saving my faces-config.xml:
保存我的时出现以下错误faces-config.xml:
the markup document following the root element must be well formed
And my xml is:
我的 xml 是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<managed-bean>
<managed-bean-name>UserBean</managed-bean-name>
<managed-bean-class>com.jsfcompref.register.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/register.jsp</from-view-id>
<navigation-case>
<from-outcome>register</from-outcome>
<to-view-id>/confirm.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
I have closed all the tags properly, still I am getting this error.
我已正确关闭所有标签,但仍然收到此错误。
回答by BalusC
The open tag <faces-config>is missing. Put it between <DOCTYPE...>and <managed-bean>.
<faces-config>缺少打开的标签。放在<DOCTYPE...>和之间<managed-bean>。
回答by nash
Use any JSF IDE, so that you are not bothered with such markup issues. Virtually all IDE's supporting JSF provide a GUI for handling faces-config.xml file
使用任何 JSF IDE,这样您就不会被此类标记问题所困扰。几乎所有支持 JSF 的 IDE 都提供了一个用于处理 faces-config.xml 文件的 GUI

