Hello!


btw: your code wont work if user enter on same page second time
obviously if(array != null) is true so no "bla bla" is performed
Why? My experience shows that it works. It want work if I will use session scope beans, but I use request scope. But I agree that getter should be getter and nothing more.

Sławek Sobótka

Hello!

As I understand, MyFaces (and core JSF too) evaluates value getter for DataTable twice (or three times if preserveDataModel == true). If we are getting static data there is no problems, but if we'are populating data from SQL we get a big problems (as query are running twice). For the time present I found no another solution as:

public Collection getDatatableValue() {
    if(array != null)
        return array;
    array = new ArrayList();
    .... bla bla populating array
    return array;
}

Same may be done with DataModel. Want to know what other people doing in this sutiations? May be there is another solution?

With respect,
    Boris




Regards,
        Boris

Reply via email to