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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:53:44+00:00 2026-05-27T13:53:44+00:00

XHTML file: <p:tab title=firstTab id=FT> <p:dataTable var=… value=#{…} id=firstTable selectionMode=multiple selection=#{myController.selectedRows}> <p:column>…</p:column> <p:column>…</p:column> <p:commandButton

  • 0

XHTML file:

    <p:tab title="firstTab" id="FT">

        <p:dataTable var="..." value="#{...}" id="firstTable" selectionMode="multiple"
        selection="#{myController.selectedRows}">
            <p:column>...</p:column>
            <p:column>...</p:column>
            <p:commandButton value="View" action="#myController.viewSelected}"/>
        </p:dataTable>
    </p:tab>

    <p:tab title="secondTab" id="ST">

        <p:dataTable var="..." value="#{...}" id="secondTable" selectionMode="multiple"
        selection="#{myController.selectedRows}">
            <p:column>...</p:column>
            <p:column>...</p:column>
            <p:commandButton value="View" action="#myController.viewSelected}"/>
        </p:dataTable>
    </p:tab>

Managed Bean:

@ManagedBean
@RequestScoped
public class MyController{
    MyObject[] selectedRows;
        //get+set

    public void viewSelected(){
        System.out.println(selectedRows.length)
    }
}

The console output varies. Sometimes the output is 0 but usually the selectedRows content gets messed up. The result is mixed if i have selections in both dataTable-s and press one of the two commandButton-s. I’m guessing that this is happening because there isn’t a specific id for the buttons or maybe i should use different business attributes for every dataTable. Which is the correct solution for this problem?

Thanks!

  • 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-27T13:53:45+00:00Added an answer on May 27, 2026 at 1:53 pm

    What PF version are you using?

    Also if that commandButton isn’t inside a column or anything else, what’s the deal with him?
    If you want to be a dataTable footer you have to do like this:

    <f:facet name="footer"> 
       <p:commandButton value="View" action="#myController.viewSelected}"/>
    </facet> 
    

    The way you are assigning the selected rows from both dataTables to the same array, I’d say this isn’t a good practice, in fact I have never seen something like this! What’s point? Even you would like to have two dataTables with the same records, you should at least assign a different array/list for selected records in each table and put them in different forms if you don’t want to trigger both events on pressing just a commandButton…

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

Sidebar

Related Questions

From my xhtml file: <h:inputTextarea value=#{newPostForm.post.body}> <f:converter converterId=NL2BRConverter /> </h:inputTextarea> From my java file:
In my .xhtml file, I have the following SelectOneMenu component: <ui:define name=formContent> <h:selectOneMenu value=#{mrBean.itemCategoryID}>
I am trying to use Python's ElementTree to generate an XHTML file. However, the
xml.etree.ElementTree.parse is choking on my xhtml file. I saw somewhere that lxml can handle
I want to find all stylesheet definitions in a XHTML file with lxml.etree.findall .
I am writing an XSLT file to translate an XML document into an XHTML
When running on an xhtml page, xpath doesn't seem to return any results. var
I need to read an XHTML file with an Android app. How can I
How I can write a phone number in the xhtml file and when the
I am using JSF tags within an XHTML file. My intention is to enable

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.