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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:53:34+00:00 2026-05-29T05:53:34+00:00

I have a dataTable that shows data stored in a database. One of the

  • 0

I have a dataTable that shows data stored in a database. One of the column contains a commandLink (p:commandLink) to edit selected row which is fine.

I have a problem during the rendering of my xhtml page. It seems that the method of backingBean in the actionListener attribute of commandLink is processed for every row in the table, but the actionListener should be processed only when link is clicked.

Here is my xhtml page (part of):

<h:form id="formElenco">
    <p:dataTable id="dt1" value="#{myBean.itemList}" var="item">
        <f:facet name="header">
            <h:outputText value="header" />
        </f:facet>
        <p:column>
            <f:facet name="header">
                <h:outputText value="Name" />
            </f:facet>
            <h:outputText value="#{item.name}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <h:outputText value="value" />
            </f:facet>
            <h:outputText value="#{item.value}"/>
        </p:column>
        <p:column>
            <p:commandLink id="lnkItemUpdate" value="Edit"
                            onstart="document.getElementById('divUpdateItem').style.display = 'block';"
                            actionListener="#{myBean.updateItemAction(item)}" update=":formUpdateItem" />
        </p:column>

    </p:dataTable>
</h:form>

<div id="divUpdateItem" style="display:none" > 
    <h:form id="formUpdateItem">
        Nome <h:inputText value="#{myBean.name}" /><br/>
        Met  <h:inputText value="#{myBean.value}" /><br/>
        <h:inputHidden value="#{myBean.id}" />
        <h:commandButton action="#{myBean.updateItemAction}" value="Save" />
    </h:form>
</div>

Here are myBean’s method (myBean is requestScoped):

public String updateItemAction(Entity item){
    this.setId(item.getId());
    this.setName(item.getName());
    this.setValue(item.getValue());
    return null;
}

public String updateItemAction() {
    Entity entity = new Entity();
    entity.setId(this.getId());
    entity.setName(this.getName());
    entity.setVAlue(this.getValue());
    updateEntityQueryMethod(entity);
    return null;
}
  • 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-29T05:53:36+00:00Added an answer on May 29, 2026 at 5:53 am

    This isn’t a valid method signature for an actionListener, so it’s treated as a value expression by the <p:commandLink>.

    You should be using action instead.

    <p:commandLink id="lnkItemUpdate" value="Edit"
        onstart="document.getElementById('divUpdateItem').style.display = 'block';"
        action="#{myBean.updateItemAction(item)}" update=":formUpdateItem" />
    

    Note that you can also just return void instead of a null String.

    public void updateItemAction(Entity item) {
        this.setId(item.getId());
        this.setName(item.getName());
        this.setValue(item.getValue());
    }
    

    A valid actionListener method signature would be a void method taking javax.faces.event.ActionEvent argument:

    public void actionListener(ActionEvent event) {
        // ...
    }
    

    See also:

    • Differences between action and actionListener
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datatable that contains rows of transaction data for multiple users. Each
I have an application that shows some data in p:DataTable.... This table is accessible
I have 3 collection datatable that shows in this below Month: January ID NAME
I have a DataTable that has a boolean column called [Invalid]. I need to
I have a datatable that has a date column, but I am stumped as
I have a DataTable that I manually created and loaded with data using C#.
i have a datatable which connected to DB... i want make the data inside
I have a telerik:RadGrid that is bound to a SQL Data Source. One of
I have a data access layer which returns DataSets/DataTables by executing Stored Procedure. Everything
I have a SQLite database that is displayed in a data grid view in

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.