XML或文本声明不在实体的开头
抱歉有点愚蠢.但我明白(我缺乏知识)如果你想在那个页面上使用RichFaces组件,就不可能转发到另一个页面.
这是我转发到具有RichFaces组件的页面时遇到的一些问题 >如果我转发到带有表单的页面,则会有数百个包含的JavaScrip被解释为格式错误的XML标记. 我不需要转发到具有RichFaces组件的页面,但是拥有该选项会很好.可能我误解了如何使用RichFaces的关键. 仅为了您的信息,我在NetBeans 7.0.1中创建了一个全新的Web项目并制作了两个页面.通过a4j:commandLink我从第一页转发到第二页有一个选项卡面板.渲染变得混乱,面板变得无法使用.除了包含RichFaces所需的库和标签之外,新项目完全没有web.xml和rich-faces.xml中的setup参数. 当我转发到具有RichFaces组件的页面时,我错过了什么? PS.如果有一个模式可以遵循,这将有助于如何使页面转发与RichFaces一起工作. 问候克里斯. 这是firebug报告的错误(在调用转发之后) XML or text declaration not at start of entity http://localhost:8080/humis/faces/app_user/projectHome.xhtml Line 7 Firebug报告页面的这些状态 > 200 OK 它是标题中的内容,包括20-30个脚本.不知道如何在这里包含长html列表.它自己接受的请求没问题,但RichFaces生成了一些我可以在向前进到页面时控制的东西. masterLayout文件; <h:head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <h:outputStylesheet name="css/default.css"/> <h:outputStylesheet name="css/cssLayout.css"/> <title> <h:outputText value="Partner Tapestry - " /> <ui:insert name="title">Browser Title</ui:insert> </title> </h:head> <h:body> <div id="top" > <ui:insert name="top">Top Default</ui:insert> </div> <div id="messages"> <rich:messages id="messagePanel" ajaxRendered="true"/> </div> <div id="content"> <ui:insert name="content">Content Default</ui:insert> </div> </h:body> 使用模板的文件 <ui:composition template="/resources/masterLayout.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <ui:define name="title"> <h:outputText value="#{bundle.EditActivityTitle}"></h:outputText> </ui:define> <ui:define name="top"> <ui:include src="#{userController.roleMenuPath}"/> </ui:define> <ui:define name="content"> <rich:panel header="Edit Activity" styleClass="center_content"> <h:form id="activity_edit_form"> ... </h:form> </rich:panel> </ui:define> </ui:composition> 我在用: > RichFaces 4.0决赛 解决方法
此错误表明您有悬空<?xml ...?>生成的HTML输出的错误位置的声明.这是无效的,文档顶部应该有一个,或者最好没有人(否则MSIE可能会破坏).检查您的Facelets是否包含模板和标记文件,并确保它们都包含在 因此,虚构的include.xhtml必须如下所示: <?xml version="1.0" encoding="UTF-8"?> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h2>Include page</h2> <p>Include page blah blah lorem ipsum</p> </ui:composition> 因此不是这样的: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <?xml version="1.0" encoding="UTF-8"?> <h2>Include page</h2> <p>Include page blah blah lorem ipsum</p> </ui:composition> 甚至 <?xml version="1.0" encoding="UTF-8"?> <x:anotherComponent xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h2>Include page</h2> <p>Include page blah blah lorem ipsum</p> </x:anotherComponent> 顺便说一句,Facelets完全可以省略XML声明. 也可以看看: > How to include another XHTML in XHTML using JSF 2.0 Facelets? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |