weixin_42349387 2009-12-01 21:39
浏览 426
已采纳

JSF Error Traced[line: 1] The markup in the document preceding the root element

麻烦大虾看看哪出错了!谢谢 :x

[code="java"]
2009-12-1 21:33:13 com.sun.facelets.FaceletViewHandler handleRenderException
严重: Error Rendering View[/userLogin.jsp]
com.sun.facelets.FaceletException: Error Parsing /userLogin.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:496)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
2009-12-1 21:33:13 com.sun.faces.lifecycle.LifecycleImpl phase
警告: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1000bcf) threw exception
com.sun.facelets.FaceletException: Error Parsing /userLogin.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
[/code]

下面是userLogin.jsp 页面
[code="java"]
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<f:view>
    <f:loadBundle var="bundle" basename="messages"></f:loadBundle>
    <h:outputLabel value="#{bundle.login_label}"></h:outputLabel><br>

    <h:form id="loginForm">
        <h:outputLabel for="username" value="#{bundle.username_label}"></h:outputLabel>
        <h:inputText id="username" value="#{UserBean.username}"></h:inputText><br/>

        <h:outputLabel for="password" value="#{bundle.userpassword_label}"></h:outputLabel>
        <h:inputSecret id="password" value="#{UserBean.password}"></h:inputSecret><br/>

        <h:commandButton id="submit" value="LOGIN" action="#{UserBean.login}" type="submit"></h:commandButton>
    </h:form>
</f:view>

[/code]
[b]问题补充:[/b]
找到了,
将下面配置从faces-config.xml中去掉就可以了.


com.sun.facelets.FaceletViewHandler

  • 写回答

2条回答 默认 最新

  • xkuff 2009-12-01 22:15
    关注

    JSF初试--解释错误原因error Traced[line: 5] The markup in the document preceding the root element must be well-formed:
    http://www.blogjava.net/fizzwater/archive/2008/04/03/fizzwater.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端