myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "daniel ccss" <danielcc...@gmail.com>
Subject Re: Tomahawk + WorkingWithLargeTables
Date Mon, 02 Jul 2007 21:28:42 GMT
Anyone??

On 7/2/07, daniel ccss <danielccss2@gmail.com> 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<T> class and the PagedListDataModel<T> 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<Paciente> 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<Paciente> 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"%>
> <f:view>
>     <html>
>         <head>
>             <meta http-equiv="Content-Type"
>                   content="text/html; charset=windows-1252"/>
>             <title>listaPacientes</title>
>         </head>
>         <body><h:form>
>                 <h:panelGroup id="body">
>                     <t:dataTable id="data" styleClass="scrollerTable"
>                                  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">
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText value="#{tablaPacientes.numIdent
> }"/>
>                         </h:column>
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText value="#{tablaPacientes.nombre
> }"/>
>                         </h:column>
>                     </t:dataTable>
>                     <h:panelGrid columns="1" styleClass="scrollerTable2"
>
> columnClasses="standardTable_ColumnCentered">
>                         <t:dataScroller id="scroll_1" for="data"
> fastStep="10"
>                                         pageCountVar="pageCount"
>                                         pageIndexVar="pageIndex"
>                                         styleClass="scroller"
> paginator="true"
>                                         paginatorMaxPages="9"
>                                         paginatorTableClass="paginator"
>
> paginatorActiveColumnStyle="font-weight:bold;"
>                                         immediate="true">
>                             <f:facet name="first">
>                                 <t:graphicImage url="images/arrow-
> first.gif"
>                                                 border="1"/>
>                             </f:facet>
>                             <f:facet name="last">
>                                 <t:graphicImage url="images/arrow-last.gif
> "
>                                                 border="1"/>
>                             </f:facet>
>                             <f:facet name="previous">
>                                 <t:graphicImage url="images/arrow-
> previous.gif"
>                                                 border="1"/>
>                             </f:facet>
>                             <f:facet name="next">
>                                 <t:graphicImage url="images/arrow-
> next.gif"
>                                                 border="1"/>
>                             </f:facet>
>                             <f:facet name="fastforward">
>                                 <t:graphicImage url="images/arrow- ff.gif"
>                                                 border="1"/>
>                             </f:facet>
>                             <f:facet name="fastrewind">
>                                 <t:graphicImage url="images/arrow- fr.gif"
>                                                 border="1"/>
>                             </f:facet>
>                         </t:dataScroller>
>                         <t:dataScroller id="scroll_2" for="data"
>                                         rowsCountVar="rowsCount"
>
> displayedRowsCountVar="displayedRowsCountVar"
>                                         firstRowIndexVar="firstRowIndex"
>                                         lastRowIndexVar="lastRowIndex"
>                                         pageCountVar="pageCount"
>                                         immediate="true"
>                                         pageIndexVar="pageIndex">
>                             <h:outputFormat
> value="#{example_messages[\'dataScroller_pages\']}"
>                                             styleClass="standard">
>                                 <f:param value="#{rowsCount}"/>
>                                 <f:param
> value="#{displayedRowsCountVar}"/>
>                                 <f:param value="#{firstRowIndex}"/>
>                                 <f:param value="#{lastRowIndex}"/>
>                                 <f:param value="#{pageIndex}"/>
>                                 <f:param value="#{pageCount}"/>
>                             </h:outputFormat>
>                         </t:dataScroller>
>                     </h:panelGrid>
>                 </h:panelGroup>
>                 <t:commandLink value="test" immediate="true"/>
>             </h:form></body>
>     </html>
> </f:view>
> 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!!!
>

Mime
View raw message