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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:29:33+00:00 2026-05-27T21:29:33+00:00

My product is using JSF with Primefaces 2.2. What I need is to process

  • 0

My product is using JSF with Primefaces 2.2. What I need is to process a sub-datatable inside another datatable. The code is as below.

<h:form>
<p:dataTable id="myInvoiceTable"
    value="#{globalBean.invoices}" var="invoice">

    <p:column>
      <f:facet name="header">
        <h:outputText value="Bill ID" />
      </f:facet>
      <h:outputText value="#{invoice.billId}" />
    </p:column>

    <p:column>
      <f:facet name="header">
        <h:outputText value="Item" />
      </f:facet>
      <h:outputText value="#{invoice.item}" />
    </p:column>

    <p:rowExpansion>

      <h:selectOneMenu id="reasons" value="#{invoiceAction.reason}">
         <f:selectItem itemLabel="Reason 1" itemValue="Reason 1"></f:selectItem>
         <f:selectItem itemLabel="Reason 2" itemValue="Reason 2"></f:selectItem>
      </h:selectOneMenu>

      <p:inputText id="activity_amount" value="#{invoiceAction.activity_amount}"/>

      <p:commandButton value="PROCESS" action="invoice_process" update="actions_table">
      </p:commandButton>

      <p:dataTable id="actions_table" value="#{invoice.actions}" var="invAction">

         <p:column>
            <h:outputText value="#{invAction.reason}" />
         </p:column>

         <p:column>             
            <h:outputText value="#{invAction.activity_amount}" />
         </p:column>

      </p:dataTable>

    </p:rowExpansion>

</p:dataTable>

Here’s my bean.

public class Invoice {
    private int billId;
    private String item;
    private List<InvoiceAction> actions;

    // Getter & setter here
}

public class InvoiceAction {
    private String reason;
    private double activity_amount;
    private int billId;

    // Getter & setter here;
}

But when the HTML is generated, it’s not processed as desired. Only the select menu in the last row of datatable can receive the data chosen by user, others can’t. Because all select menus in all rows are using the same object (#{invoiceAction}), and the bean just gets the value of the last component in the page. I knew the root cause but I don’t know how to solve it. How to let they submit in the specified row?

  • 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-27T21:29:34+00:00Added an answer on May 27, 2026 at 9:29 pm

    First of all, I think your Invoice and InvoiceAction classes look just like normal Java objects. I feel that they should not be Managed Bean.

    Besides, you’re right that your #{invoiceAction} is not correctly binded to one of the actions in List<InvoiceAction> actions. Since you are using nested <p:dataTable>, I think you can take advantage of <p:cellEditor>. It would be something like this:

    <p:rowExpansion>
       <p:dataTable id="actions_table" value="#{invoice.actions}" var="invAction">
    
          <p:column>
             <p:cellEditor>  
                <f:facet name="output">  
                   <h:outputText value="#{invAction.reason}" />   
                </f:facet>  
                <f:facet name="input">  
                   <h:selectOneMenu id="reasons" value="#{invoiceAction.reason}">
                      <f:selectItem itemLabel="Reason 1" itemValue="Reason 1" />
                      <f:selectItem itemLabel="Reason 2" itemValue="Reason 2" />
                   </h:selectOneMenu>
                </f:facet>  
             </p:cellEditor>
          </p:column>
    
          <p:column>
             <p:cellEditor>  
                <f:facet name="output">  
                   <h:outputText value="#{invAction.activity_amount}" />   
                </f:facet>  
                <f:facet name="input">  
                   <p:inputText id="activity_amount" value="#{invoiceAction.activity_amount}" />
                </f:facet>  
             </p:cellEditor>
          </p:column>
    
       </p:dataTable>
    
       <p:commandButton value="PROCESS" action="invoice_process" update="actions_table" />
    </p:rowExpansion>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a product catalog using apache, php and mysql. I need to put
I have a product class in C# that inherits from another product class using
Rolling my own twitter style service within another product using php, and it just
I am building a site using code igniter. I am developing a custom product
I'm using JSF 1.1. I have a JSP page with a .... <t:dataTable id=data
My company has developed a long standing product using MFC in Visual C++ as
I'm engaged in writing a product using LinqToSql for data-access. While we're rapidly developing,
My Xcode project builds to variations of the same product using two targets. The
Our product is using MS SQL Compact Edition on a Windows machine (laptop). It's
In my Django project I am using Product.objects.all().order_by('order') in a view, but it doesn't

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.