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条)

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站