user712904
user712904

Reputation:

Primefaces , jquery issue on including page with ui:include in p:tabview

I had build a JSF 2.1.2 page with various primefaces components like p: calendar, p: selectOneMenu ... This page works fine. But : I need to integrate this first page in an other page in a p:tab element with p: TabView parent : like this:

<p:tabView id="tabview">
 <p:tab title="User admin">
  <ui:include src="firstPage.xhtml" />
 </p:tab>
</p:TabView>

Problem: primefaces components no longer works (no display with p:calendar for exemple) , I get many errors with firebug like jQuery is absent :

$(this.jqId + " ul").sortable is not a function
[Stopper sur une erreur]    

...d+" .ui-picklist-target-controls .ui-picklist-button-move-up").click(function(){...

primef...mefaces (ligne 27)
$(this.jqId + " ul").sortable is not a function
[Stopper sur une erreur]    

...d+" .ui-picklist-target-controls .ui-picklist-button-move-up").click(function(){...

.....

Thanks for your help. Christophe.

Upvotes: 1

Views: 2524

Answers (1)

BalusC
BalusC

Reputation: 1108632

Make sure that your HTML output is syntactically valid. If the firstPage.xhtml represents a complete <html> page, then this will fail when you use it as an include file in another <html> page because nesting <html><head><body> tags is illegal.

You need to remove all <html><head><body> tags from firstPage.xhtml that way so that it really represents the sole tab content. E.g.

<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"
    xmlns:p="http://primefaces.org/ui"
>
    <p>This is the tab content.</p>
</ui:composition>

Upvotes: 2

Related Questions