Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6750883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:51:38+00:00 2026-05-26T12:51:38+00:00

How can I use id of DataTable Component (Primefaces 2.2.1) inside Composite Component in

  • 0

How can I use id of DataTable Component (Primefaces 2.2.1) inside Composite Component in Java Server Faces 2.1 ?

Now, I have a view:

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

    <ui:define name="content">
        <h:form prependId="false">  <!-- prependId="true" ??? -->
            <p:dataTable id="leakTable" var="leak" value="#{dataExplorer.data}">   

                <p:column filterBy="#{leak.source}" headerText="source" footerText="source" filterMatchMode="contains" >  
                    <f:facet name="header">  
                        <h:outputText value="source" />  
                    </f:facet>  
                    <h:outputText value="#{leak.source}"  />  
                </p:column>  

                <!-- Few more columns here -->
            </p:dataTable> 

            <!-- Add : prefix before ID? -->
            <haiq:exporter target=":leakTable" fileName="#{msgs.fileName}" imageLibrary="images" pageOnly="false" />

        </h:form>   
    </ui:define>
</ui:composition>

My composite component:

<?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:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.prime.com.tr/ui">

<!-- INTERFACE -->
<cc:interface>
    <cc:attribute name="fileName" default="data" />
    <cc:attribute name="target" required="true" type="java.lang.String" />
    <cc:attribute name="pageOnly" default="true" type="java.lang.Boolean" />
    <cc:attribute name="imageLibrary" default="images" />
</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
    <h:commandLink>  
        <h:graphicImage library="#{cc.attrs.imageLibrary}" name="excel.png" />  
        <p:dataExporter type="xls"
                        target="#{cc.attrs.target}" 
                        fileName="#{cc.attrs.filename}" 
                        pageOnly="#{cc.attrs.pageOnly}" />  
    </h:commandLink>  
</cc:implementation>
</html>

After view rendering, following error occurred:

javax.faces.FacesException: Cannot find component ":leakTable" in view.
at org.primefaces.component.export.DataExporter.processAction(DataExporter.java:89)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)

Removing : before leakTable (in target attribute) or changing preperndId (in form) to true does not solve the problem.

How can I use datatable inside cc?
Similar problem is described here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:51:39+00:00Added an answer on May 26, 2026 at 12:51 pm

    Apparently you’ve another NamingContainer parent in the view. To be sure, open page in browser, rightclick and View Source and determine the generated ID of <p:dataTable id="leakTable">. Then, you should grab exactly that ID and prefix with :.

    Alternatively, you can also bind the table component to the view and use UIComponent#getClientId() instead to dynamically refer the client ID.

    <p:dataTable binding="#{leakTable}" ...>
    

    with

    <haiq:exporter target=":#{leakTable.clientId}" ...>
    

    Unrelated to the concrete problem, I suggest to replace <!DOCTYPE><html> of your composite by <ui:component>, which is more natural and it also saves JSF from doing it impliticly everytime.

    <ui:component
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:cc="http://java.sun.com/jsf/composite"
        xmlns:p="http://primefaces.prime.com.tr/ui">
    

    See also https://stackoverflow.com/tags/composite-component/info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to use Richfaces DataTable with DataTableModel to have server side paging and
I have a question about updating variable inside dataTable component, which was sended to
I currently use a DataTable to get results from a database which I can
You can use XPath if you're binding the XML document in the XAML, but
I know you can use a <rich:datascroller> when you want pagination on a <rich:dataTable>
We have a third-party DLL that can operate on a DataTable of source information
I would like to use the Microsoft Report Viewer component to view a report
I make some table use DataTable. I make this table can filtering data from
I have a basic datatable, it can be completely generic for this example, except
What object can I use that has rows and columns, but not DataTable as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.