I'm using p:remoteCommand to dynamically update content included with ui:include on a wizard page. The problem is, however, that the new included components use h:outputStylesheet and h:outputScript and none of those files get included into the page, so all styles and new scripts that the included components should be using are missing.
I'm running latest PrimeFaces 2.0.3-SNAPSHOT on Glassfish v3.
p:remoteCommand does not include new stylesheets
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Can you post your code, I think you need to manually add the resources that are not available on the page first.
I'll create a simple test, but I think I'm talking about the same problem (dynamic loading of new resources in PPR requests) this thread is about:
http://primefaces.prime.com.tr/forum/vi ... 1&start=10
In that thread you're talking about an improvement to load the resources dynamically, but it seems that it is not implemented yet.
I've even tried to get the h:head part of the page updated after a PPR request that should include new resources, but I still get the old ones until I do a complete non-PPR page refresh.
http://primefaces.prime.com.tr/forum/vi ... 1&start=10
In that thread you're talking about an improvement to load the resources dynamically, but it seems that it is not implemented yet.
I've even tried to get the h:head part of the page updated after a PPR request that should include new resources, but I still get the old ones until I do a complete non-PPR page refresh.
I've solved the problem.
What I'm doing is that I'm including a page dynamically using ui:include like this:
(p:remoteCommand is needed to make ui:include work correctly as the page gets included before the action method togglePage() is executed due to the way ui:include works...)
The problem with the included pages was that none of any new resources that the components used were included on the page, so the included pages were not displayed correctly.
I noticed that the included pages were constructed incorrectly using ui:composition instead of proper f:view with h:body (this was just because of me copy-pasting).
However, the included pages also need to have the h:head section (an empty one will do) to get the new resources included with the AJAX PPR request.
Here's an example of an included page that works:
Cagatay, could you verify whether the correct approach is to have h:head in the included page to force loading of new resources?
What I'm doing is that I'm including a page dynamically using ui:include like this:
(p:remoteCommand is needed to make ui:include work correctly as the page gets included before the action method togglePage() is executed due to the way ui:include works...)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<body>
<ui:composition>
This is outside the form: <h:outputText value="#{testBean.src}" /><br/>
<h:form>
<p:commandLink ajax="true" value="Toggle page"
action="#{testBean.togglePage()}"
update="@none"
oncomplete="updateForm()" />
<h:panelGroup layout="block">
<ui:include src="#{testBean.src}" />
</h:panelGroup>
<p:remoteCommand name="updateForm" process="@none" update="@form" />
</h:form>
</ui:composition>
</body>
</html>
I noticed that the included pages were constructed incorrectly using ui:composition instead of proper f:view with h:body (this was just because of me copy-pasting).
However, the included pages also need to have the h:head section (an empty one will do) to get the new resources included with the AJAX PPR request.
Here's an example of an included page that works:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<html xmlns="http://www.w3.org/1999/xhtml">
<h:head>
<title>Test</title>
</h:head>
<h:body>
<h:form>
Page1 with calendar:<br />
<p:calendar mode="inline" />
</h:form>
</h:body>
</html>
</f:view>
I have the same problem, but adding back h: head, I do not think the solution, due to re-load resources, we assume that these have already been loaded into the template
Primefaces 3.5, PrimeFaces Extensions 0.6.3, OmniFaces 1.4.1, Tomcat 7, Maven 3, JSF 2.1.21
I have the same problem,but i don't think it is a solution,because the included page is a part of parent page,it shouldn't has head and body.And if you do this the viewScope Bean will not be working.
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
-
- Information
-
Who is online
Users browsing this forum: No registered users and 33 guests