jsf应用程序中的org.apache.jasper.JasperException

时间:2012-12-15 16:00:45

标签: java jsp jsf tomcat icefaces

打开jspx页面时出现以下错误。

org.apache.jasper.JasperException: /login.jspx(9,54) Document root element "ui:composition", must match DOCTYPE root "composition".
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:214)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
    at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:120)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:180)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    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:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

JSF文件内容:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
    template="/jsp/common/classic-template-login.jspx"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:c="http://java.sun.com/jstl/core"
        xmlns:ice="http://www.icesoft.com/icefaces/component"
        xmlns:ui="http://java.sun.com/jsf/facelets" >

    <div align="left"><ui:define name="title">OES Admin</ui:define></div>

    <ui:define name="toolbar">
    </ui:define>

    <ui:define name="pageView">

    <ui:decorate template="/jsp/common/page-include-template.jspx">

        <ui:define name="pageName" ></ui:define>

        <ui:define name="pageActions">
        </ui:define>

        <ui:define name="pageContent">
            <ui:include src="/WEB-INF/includes/login.jspx"/>
        </ui:define>        
      </ui:decorate>
    </ui:define>
</ui:composition>

1 个答案:

答案 0 :(得分:0)

警惕你的术语:这是一个facelets页面,而不是JSP页面。仅仅因为你将你的网址映射到'* .jspx'并不是这样。您可能认为这是一个小问题,但facelets是JSP技术的完全替代品,并且在幕后工作方式完全不同。

我唯一可以发现的是我自己的facelets页面之间的区别是我的附加名称空间声明。

<ui:composition xmlns="http://www.w3.org/1999/xhtml"