users@glassfish.java.net

Re: JSF h:dataTable element seems to have a bug

From: <forums_at_java.net>
Date: Sun, 31 Jul 2011 17:00:19 -0500 (CDT)

Hello Duncan,

Thanks for the reply. I will check out ##jsf irc channel on freenode. I
wasn't aware of its existence.

Initializing the list before executing the getter method is not an option for
me, since I want to populate the table dynamically in response to a user
request, with the table's contents being unique to each request. I did get a
workaround suggestion from another list, however. This is to use what he
calls a "lazy getter" as in the following.

private ArrayList dataList = null;

public ArrayList getDataList() {

  if ( dataList == null ) {

  System.out.println("inside getDataList()");

  dataList = new ArrayList();

  dataList.add("Data item 1");

  dataList.add("Data item 2");

  }

  return dataList;

}

The fact that what I observed is common behavior doesn't make it desirable. I
would recommend that for any future versions of JSF an effort be made to
implement it in such a way that such workarounds aren't needed.

Best regards,

--Dan Schwartz


--
[Message sent by forum member 'Dan_Schwartz']
View Post: http://forums.java.net/node/828015