includeFacelets jsf

Dai galera to com um problema em um componente de abas que estou criando no jsf, estou usando o jquery para fazer as abas, bom o seguinte qunado vou adicionar mais uma aba eu faço o include de um xhtml dentro de um panel na primeira fez funciona, mas se eu abrir uma segunda aba o jsf mescla os codigos dos dois xhtml nao sei o porque isso acontece por isso pedia a ajuda de voces vou postar o codigo para voces visualizarem.

public abstract class TabController {
	
	public static final String ATTRIBUTE_IDTAB = "idTab";
	
	protected static final String ID_PAGE = "page";
	
	public abstract List<View> getList();
	
	public abstract void setList(List<View> l);
	
	public abstract boolean addView(View v);
	
	public abstract boolean removeView(ActionEvent event);
	
	public abstract HtmlPanelGroup getPanelGroup();
	
	public abstract void setPanelGroup(HtmlPanelGroup panel);
	
	protected abstract void addDiv(View v);
	
	protected void setId(UIComponent comp, View v) {
		String id = setIdComponent(comp) + ":" + ID_PAGE + getList().size();
		v.setIdTab(id);
		v.setIdDiv(ID_PAGE + getList().size());
	}
	
	private String setIdComponent(UIComponent comp) {
		if(comp.getParent() == null) {
			return comp.getId();
		} else {
			return setIdComponent(comp.getParent()) + ":" + comp.getId();
		}
	}
	
	public boolean getRendererComponent() {
		if(getList() == null) {
			return false;
		} else if(getList().size() == 0) {
			return false;
		} else {
			return true;
		}
	}
	
	protected View getView(String idTab) {
		
		View v = null;
		
		for(View view : getList()) {
			if(view.getIdTab().equals(idTab)) {
				v = view;
				break;
			}
		}
		
		return v;
		
	}
	
	protected void setInclude() {

		//limpa a lista de filhos do componente
		this.getPanelGroup().getChildren().clear();
		
		for(View view : getList()) {
			addDiv(view);
		}
		
	}
	
	protected void includeFacelet(UIComponent comp, String page) throws FaceletException, FacesException, ELException, IOException {
		FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
		faceletContext.includeFacelet(comp, page);
	}
	
}


public class DefaultTabControllerImpl extends TabController{
	
	private List<View> listView;
	private HtmlPanelGroup panelGroup;
	
	public DefaultTabControllerImpl() {
		this.listView = new ArrayList<View>();
	}
	
	@Override
	public List<View> getList() {
		return this.listView;
	}

	@Override
	public void setList(List<View> l) {
		this.listView = l;
	}

	@Override
	public boolean addView(View v) {		
		for(View view : this.listView) {
			if(view.getIdDiv().equals(v.getIdDiv())) {
				return false;
			}
		}
		this.listView.add(v);
		addDiv(v);
		return true;
	}

	@Override
	public boolean removeView(ActionEvent event) {
		
		String idTab = (String) event.getComponent().getAttributes().get(ATTRIBUTE_IDTAB);
		
		View view = getView(idTab);
		
		int index = this.listView.indexOf(view);
		
		if(index == -1)
			return false;
		else
			return this.listView.remove(view);
	}

	@Override
	public HtmlPanelGroup getPanelGroup() {
		return this.panelGroup;
	}
	
	@Override
	public void setPanelGroup(HtmlPanelGroup panel) {
 		this.panelGroup = panel;
		
		//if(this.getPanelGroup() != null) 
			//setInclude();
	}
	
	@Override
	protected void addDiv(View v) {
		try {
			
			//setId(this.panelGroup, v);
			includeFacelet(this.panelGroup, v.getPathFile());
			
		} catch (Exception e) {
			e.printStackTrace(System.err);
		}
	}

}


<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui" >

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="managedBean" required="true" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

    	<ui:fragment rendered="#{cc.attrs.managedBean.rendererComponent}">
    	
    		<div id="tabs">
	    		<ul>
			        &lt;ui:repeat value="#{cc.attrs.managedBean.list}" var="teste"&gt;
			        	<li>
							<a >#{teste.title}</a>
			        	</li>
			        &lt;/ui:repeat&gt;
			        
	    		</ul>       
	    		
		        &lt;h:panelGroup id="panel" layout="block" binding="#{cc.attrs.managedBean.panelGroup}" /&gt;
    		&lt;/div&gt;
	    	
    	&lt;/ui:fragment&gt;
    	
    	&lt;script type="text/javascript"&gt;
    		$("#tabs").tabs();
    	&lt;/script&gt;
    	
    &lt;/cc:implementation&gt;
&lt;/html&gt; 

se alguem poder me dar uma luz sobre isso fico muito agradecido…

Revivendo um pouco o tópico, estou com esse problema …
Quando tento pegar o FaceletContext ele me retorna null e tentei de zilhões de formas diferentes para fazer ele retornar algum valor mais nada…
O cód. que tento pegar o FaceletContext e inserir um includeFacelets…

FacesContext facesContext = FacesContext.getCurrentInstance();
FaceletContext faceletContext = (FaceletContext) facesContext.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
faceletContext.includeFacelet(facesContext.getViewRoot().findComponent("formTelas:tabTelaPrincipal:topVenda"), "/venda/filtroVenda.xhtml");

Esse cód. seria para “subistituir” o ui:include do jsf na linha de cód. :smiley: