0

打开 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>
4

1 回答 1

0

请注意您的术语:这是一个 facelets 页面,而不是 JSP 页面。仅仅因为您将您的 url 映射到 '*.jspx' 并没有做到这一点。您可能会认为这是一件小事,但 facelets 完全替代了 JSP 技术,并且在底层的工作方式完全不同。

我唯一能发现我自己的 facelets 页面之间的区别是我的有一个额外的命名空间声明。

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
于 2012-12-17T16:20:46.503 回答