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

  • Home
  • SEARCH
  • 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 4015370
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:36:39+00:00 2026-05-20T09:36:39+00:00

I have a dataTable and in each row there is a commandButton which calls

  • 0

I have a dataTable and in each row there is a commandButton which calls a method from a ManagedBean with the current item id like this:

<h:commandButton action="#{myBean.doStuff(item.id)}" value="click me"/>

This works pretty good, except the render response phase calls the doStuff method again with another (probably old?) id. I looked into this issue with a PhaseListener:

...stuff...
INFO: START PHASE INVOKE_APPLICATION 5
INFO: selecting item with Id: 11
INFO: selected item: new_item
INFO: END PHASE INVOKE_APPLICATION 5
INFO: START PHASE RENDER_RESPONSE 6
INFO: selecting item with Id: 3
INFO: selected item: test1
INFO: END PHASE RENDER_RESPONSE 6
...more stuff...

new_item is what i want and test1 is what i get.

So why does the doStuff method get called in the render response phase and why does it use wrong values?

edit: I am using JSF 2.0

  • 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-20T09:36:40+00:00Added an answer on May 20, 2026 at 9:36 am

    This normally wouldn’t be a problem. E.g. consider the following facelet:

    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core">
    
        <h:body>    
            <h:form>
    
                <h:dataTable value="#{tableBean.items}" var="item">
    
                    <h:column>
                        #{item}                
                    </h:column>
    
                    <h:column>
                        <h:commandButton value="click" action="#{tableBean.doAction(item)}" />
                    </h:column>
    
                </h:dataTable>
    
            </h:form>
    
        </h:body>
    </html>
    

    and the following backing bean:

    @ManagedBean
    @ViewScoped
    public class TableBean {
    
        private List<String> items;
    
        @PostConstruct
        public void init() {        
            items = new ArrayList<String>();
            items.add("bar");
            items.add("kaz");
            items.add("foo");        
        }
    
        public String doAction(String string) {
            System.out.println(string);
            return "";
        }
    
        public List<String> getItems() {
            return items;
        }    
    
    }
    

    This doesn’t print anything extra in the render response phase. Perhaps you need to show more code. You could additionally try to abstract your problem to the bare essentials. If it then works step by step add your other code again until you see it breaking.

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

Sidebar

Related Questions

In C#/ASP.NET 3.5, I have a DataTable which pulls rows from the database. I
I have a datatable with few rows each row has few columns. I want
I have values stored as strings in a DataTable where each value could really
I have a DataTable that queries out something like below usergroupid...userid......username 1.............1...........John 1.............2...........Lisa 2.............3...........Nathan
I have a DataTable which is bound to a GridView. I also have a
I have a DataTable. I'd like to sort its default view by a column
I have a DataTable with results already pulled down from a back end. I
As you understand from the title above, I have a datatable and checkboxes in
I have a DataTable which I want to save to a SQLite Database Table.
I have a csv file with 350,000 rows, each row has about 150 columns.

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.