• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

problem displaying a list on a jsf table


I am using JSF as a controller for this application and am trying to display the contents of a list contained in a bean.
Here's an excerpt of my bean:
public class LogManageBean implements ValueChangeListener, ActionListener {
private List test;

public void SearchLog(){
// populates the test list
public List getTestList(){
return test;



In my faces config file I've declared the bean like this:


In my jsp page I want to display the contents of the list upon a button click.
      <h:commandButton value="Display" actionListener="#{viewLog.SearchLog}"  />
I don't know how can I display the contents of the list upon hitting the button. Basically how can I tie in the list to the <table> in jsp. The problem is that the button populates the list but how would the table know how to access the contents of the list.

Could someone please advise?

1 Solution
<h:dataTable value="#{logManageBean.test}"
    <h:outputText value="#{rowVar.col1Data}"/>
    <h:outputText value="#{rowVar.col2Data}"/>

col1Data and col2Data is the property field name in your test object.

You should write a getTest method, not getTestList, as the JSF would interpret the naming wrongly.


No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup Zone:
Accept doraemon-nolife comment as answer.

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

mrcoffee365 Experts Exchange Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now