Object oriented beans and datamodel initialization?

UPDATE II: Well, I managed to narrow it down a bit.

I have a data page with sorting and filtering functions that take place in the database. In other words, I do not use the rich's built-in functions: I use datatable, but rather let the database do the work.

I am working with beans query . The only session beans contains sorting and filtering my interface.

Filtering for each column is tied to specific bean sessions. Thus, it is actually updated at the stage of updating the model values.

Sorting requires some logic from my part, so I call a specific method to set the correct values ​​for the bean session. This is done during the Application Invoke phase.

Thus, any changes occur during the render response phase, where the page is actually displayed.

The problem is that the JSF datatable and datascroller on my page calls backingBean.getDataModel(), which retrieve data from the database and dataModel.getRowCount()(which I implemented to call the method that executes a separate request) also during the Apply request phase . These two requests are also taken during the render response phase, which is the only phase when the changes are all in place, and the request will work fine.

This means that to display the page after filtering or sorting, double the number of requests.

I want to perform sorting and filtering only to fulfill the required queries and no more.

Any suggestions?

+3
source share
1 answer

A getter call during the application of the request request phases is mandatory because the JSF needs to know which input values ​​were initially shown so that it can ultimately perform any check and / or call any values ​​of event participants in the next phase, where applicable. It is also necessary to find out which button / link was pressed / pressed in any of the lines, so that it knows which bean action is called in the call action phase.

- , / - / , , .

, . bean SQL- ( ) bean bean, bean ( ) bean ( // ). , /, enduser , "wtf?". .

Tomahawk , preserveDataModel <t:dataTable>, datamodel , (, , , , faces-config). RichFaces , <a4j:keepAlive> . "" bean, , bean , , . bean, bean.

, , , , (, , , ). , SQL HTTP-.

, .

+1

Source: https://habr.com/ru/post/1734587/


All Articles