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 8457393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:47:42+00:00 2026-06-10T12:47:42+00:00

I have a JSF application with a Data Table. Each row has a ‘commandLink’.

  • 0

I have a JSF application with a Data Table. Each row has a ‘commandLink’. When the commandLink of a row is clicked then row data must be displayed on console.

I am getting an error when I click on the commandLink, the error is as follows:

component with duplicate id "dataTable1:col1" found

viewId=/UserHome.xhtml
location=E:\workspaces_eclipse\webService\.metadata\.plugins \org.eclipse.wst.server.core\tmp2\wtpwebapps\JSF_Demo\UserHome.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
java.lang.IllegalStateException - component with duplicate id "dataTable1:col1" found
at  org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIds(CheckDuplic    ateIdFaceletUtils.java:100)

The error shows that components have same IDs, however I tried to give different ‘id’ to each element of the data table.

The source code of JSF file ‘UserHome.xhtml’ is as follows:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!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:f="http://java.sun.com/jsf/core"   xmlns:h="http://java.sun.com/jsf/html">
     <h:head>
    <title>Resource Net 1.0</title>
    <h:outputStylesheet library="css" name="table-style.css"></h:outputStylesheet>
</h:head>
<h:body>
   <div align="center">
   <table width="90%" height="100%" border="0" style="cellspacing:0; border-radius:10px ;box-shadow: 0px 0px 15px 10px #888888">
    <tr>
        <td>
            <h2><div align="center">Resource Net 1.0</div></h2>
        </td>
    </tr>
    <tr>
        <td>                
            2. Generated by Map :
            <h:selectOneMenu value="#{userHomeListener.favCoffee2}">
                <f:selectItems value="#{userHomeListener.allDomains}" />
            </h:selectOneMenu>
        </td>
    </tr>       
    <tr>
        <td>
            <h:dataTable value="#{userHomeListener.documents}" var="doc"
                         binding="#{userHomeListener.documentsTable}"
                          id="dataTable1"                            
                         styleClass="order-table"
                         headerClass="order-table-header"
                         rowClasses="order-table-odd-row,order-table-even-row"
                         border="1">

                <h:column id="col1">
                    <f:facet name="header1">Document ID</f:facet>
                    #{doc.docID}
                </h:column>
                <h:column id="col2">
                    <f:facet name="header2">Document Name</f:facet>
                    #{doc.docName}
                </h:column>
                <h:column  id="col3">
                    <f:facet name="header3">Document Link</f:facet>
                     <h:form id="form1">
                     <h:commandLink id="link" value="#{doc.docLink}" action="#{userHomeListener.getRowData}"></h:commandLink>
                     </h:form>
                </h:column>
                <h:column id="col4">
                    <f:facet name="header4">Upload Date</f:facet>
                    #{doc.uploadDate}
                </h:column>

            </h:dataTable>
            <h:commandButton value="get row data" ></h:commandButton>
        </td>
    </tr>
    </table>

    </div>
</h:body>

Is there some problem with my code? Kindly suggest solutions to this issue.

Thanks in advance.

  • 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-06-10T12:47:43+00:00Added an answer on June 10, 2026 at 12:47 pm

    The binding attribute of the <h:dataTable> is the suspect here. It may lead to this kind of problems when the bean is in a too broad scope and/or when you’re doing “wrong things” in the getter/setter of that attribute.

    Putting the bean in the request scope and/or looking for alternative ways so that you can get rid of the binding altogether should solve this problem.

    The combination of the binding attribute and the name of the command link action method getRowData suggests that you’re merely using it to get the current table row. This was indeed the way when using the old JSF 1.x, but not anymore when using the new JSF 2.x. This can be done much better and simpler when you’re running a Servlet 3.0 / EL 2.2 capable container (Tomcat 7, Glassfish 3, etc).

    <h:dataTable value="#{userHomeListener.documents}" var="doc">
        <h:column>
            <h:form>
                <h:commandLink value="#{doc.docLink}" action="#{userHomeListener.getRowData(doc)}" />
            </h:form>
        </h:column>
    </h:dataTable>
    

    with

    public void getRowData(Document doc) {
        // ...
    }
    

    You see, you can just pass the #{doc} straight as method argument.

    See also:

    • How can I pass selected row to commandLink inside dataTable?
    • Recommended JSF 2.0 CRUD frameworks
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my jsf application I have a button for sending mail. And each time
I have a JSF 2.0 application running on GlassFish v3. It has EJBs that
I have a JSF application that uses mostly Richfaces. I would like to introduce
I have a JSF application with several major components and a component tree under
Ok simple question. I have a JSF application, containing a login page. The problem
i have a JSF web application. I use Beans as Spring Beans (not JSF
I am new to JSF and have a problem with my simple JSF application.
We have a JSF 1.2 application with RichFaces 3.3.3 on JBoss 5.1. When we
I have a Java-JSF Web Application on GlassFish, in which I want to use
I'm trying to create an Hello World JSF application. I have a bean with

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.