打开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>
最佳答案
警惕您的术语:这是一个facelets页面,而不是JSP页面。仅仅因为您将URL映射到'* .jspx'并不能做到这一点。您可能会觉得有点小事,但是facelets完全替代了JSP技术,并且在幕后工作原理大不相同。
我唯一能看到的是我自己的facelets页之间的区别是,我有一个附加的名称空间声明。
<ui:composition xmlns="http://www.w3.org/1999/xhtml"