Sorry being a bit daft. But I come to understand (my lack of knowledge) that it's not possible to forward to another page, if you want use RichFaces components on that page.
This is some of the problems that I am experiance when forward to a page with RichFaces components
I don't need to forward to pages with RichFaces components, but it would be nice to have that option. Probably I have misunderstood something crucial on how to use RichFaces.
Just for your information, I've created a totally new web project in NetBeans 7.0.1 and made two pages. Via a4j:commandLink I forward from the first page to the second one that have a Tab Panel. The rendering get messed up and the panel becomes unusable. Except including the libs and tags necessary for RichFaces, the new project is totally clean of setup parameter in the web.xml and rich-faces.xml.
What am I missing when I forward to a page with RichFaces components?
PS. If there is a patter to follow, that would help a lot on how to make page forwarding work with RichFaces.
Greetings Chris.
This is the error firebug reports (after the forward is invoked)
XML or text declaration not at start of entity
http://localhost:8080/humis/faces/app_user/projectHome.xhtml
Line 7
Firebug report these status for the page
It is something in the header and in the 20-30 scripts included. Don't know how to include the long html list here. The request it self seams ok, but RichFaces generated something that I can control when doing a forward to the page.
The masterLayout file;
<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>
File using the template
<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>
I am using:
XML or text declaration not at start of entity
This error suggests that you have dangling <?xml ... ?>
declarations at wrong places of the generated HTML output. This is invalid, there should be one at top of the document, or preferably, no one at all (otherwise MSIE will potentially go havoc). Check your Facelets include templates and tag files and make sure that they are all wrapped inside an <ui:composition>
.
So, a fictive include.xhtml
must look like this:
<?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>
and thus not this:
<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>
or even
<?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>
It's by the way perfectly fine for Facelets to omit the XML declaration altogether.