Anyone?? On 7/2/07, daniel ccss wrote: > > Hi all, I'm new in this mailing list, and I new using My Faces, hope you > can help me. > > Things to know: i'm using JDeveloper 10.1.3.1, last My Faces, last > Tomahawk implementation version > > I made the following things: > 1-The datascroller example (http://www.irian.at/myfaces/dataScroller.jsf) > and all works fine. > 2- Then I read and implemented the article in the wiki call: WorkingWithLargeTables > (http://wiki.apache.org/myfaces/WorkingWithLargeTables ) and all works > fine, the number of links, the method who brings each DataPage, the data > that is displaying in each page, all fine. > > But I noticed that when I put a System.out.println in the method that > brings the DataPage, the method that bring the DataPage from the database is > invoked several times, for example the System.outs that appear in my > console when I: load the page, click in page2 link, and click in page3 are: > > ... LINENUM BETWEEN 0 AND 2 > ... LINENUM BETWEEN 0 AND 2 > ... LINENUM BETWEEN 0 AND 2 > ... LINENUM BETWEEN 0 AND 2 > ... LINENUM BETWEEN 2 AND 4 > ... LINENUM BETWEEN 2 AND 4 > ... LINENUM BETWEEN 2 AND 4 > ... LINENUM BETWEEN 5 AND 7 > > Why this happen? I put a breakpoint in the fetchPage(int startRow, int > pageSize) method, and in fact it is call several times for each DataPage > that is show. > > The DataPage class and the PagedListDataModel class are the same > that appears in the WorkingWithLargeTables article from wiki. > > This is the code of my bean class: > > public class PacienteBean { > > DataModel dataModel = null; > private DataPage getDataPage(int inicio, int regPorPagina) { > PacienteEJB paciente = null; > try { > final Context context = new InitialContext(); > paciente = (PacienteEJB)context.lookup("PacienteEJB"); > } catch (NamingException e) { > System.out.println(e.getMessage()); > } > return paciente.obtenerPacientes (inicio, regPorPagina); > } > > public DataModel getDataModel() { > if (dataModel == null) { > dataModel = new LocalDataModel(2); > } > return dataModel; > } > > private class LocalDataModel extends PagedListDataModel { > public LocalDataModel(int pageSize) { > super(pageSize); > } > > public DataPage fetchPage(int startRow, int pageSize) { > return getDataPage(startRow, pageSize); > } > } > public String mostrarPacientes() { > return "success"; > } > } > > The only clue that I have is that something is happening in the jsp, > beacause the wiki article donīt explains how the jsp have to be, in fact I > leave it the same as the datascroller example jsp, only changing the value > of the DataTable value="#{PacienteBean.dataModel}" and putting the > preserveDataModel="false" because I want that for each page the DataPage > be loaded from the DataBase. This is my jsp: > > <%@ page contentType="text/html;charset=windows-1252"%> > <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> > <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> > <%@ taglib uri="http://myfaces.apache.org/tomahawk " prefix="t"%> > > > > content="text/html; charset=windows-1252"/> > listaPacientes > > > > headerClass="standardTable_Header" > footerClass="standardTable_Header" > > rowClasses="standardTable_Row1,standardTable_Row2" > > columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column" > var="tablaPacientes" > value="#{ PacienteBean.dataModel}" > preserveDataModel="false" rows="2"> > > > > > > > > > > > columnClasses="standardTable_ColumnCentered"> > fastStep="10" > pageCountVar="pageCount" > pageIndexVar="pageIndex" > styleClass="scroller" > paginator="true" > paginatorMaxPages="9" > paginatorTableClass="paginator" > > paginatorActiveColumnStyle="font-weight:bold;" > immediate="true"> > > border="1"/> > > > border="1"/> > > > border="1"/> > > > border="1"/> > > > border="1"/> > > > border="1"/> > > > rowsCountVar="rowsCount" > > displayedRowsCountVar="displayedRowsCountVar" > firstRowIndexVar="firstRowIndex" > lastRowIndexVar="lastRowIndex" > pageCountVar="pageCount" > immediate="true" > pageIndexVar="pageIndex"> > value="#{example_messages[\'dataScroller_pages\']}" > styleClass="standard"> > > value="#{displayedRowsCountVar}"/> > > > > > > > > > > > > > Please help me with this, we are actually deciding which implementation of > myfaces to use, and I really trust in apache work, I donīt want that other > implementation be choose for our applications, thanks!!! >