隨筆-348  評(píng)論-598  文章-0  trackbacks-0

          第三版是對(duì)第二版的一些簡(jiǎn)化,多了一個(gè)抽象基礎(chǔ)類(lèi),方便調(diào)用。

          頁(yè)面代碼(變成了user.defaultDataModel):

              <f:view>
                  
          <h:form id="formlist">    
                      
          <rich:dataTable id="carList" width="483" columnClasses="col" rows="#{user.pageSize}"
                          value
          ="#{user.defaultDataModel}" var="car">            
                          
          <f:facet name="header">
                              
          <rich:columnGroup>
                                  
          <h:column>
                                      
          <h:outputText styleClass="headerText" value="Name" />
                                  
          </h:column>
                                  
          <h:column>
                                      
          <h:outputText styleClass="headerText" value="Decription" />
                                  
          </h:column>
                                  
          <h:column>
                                      
          <h:outputText styleClass="headerText" value="Base Price" />
                                  
          </h:column>
                                  
          <h:column>
                                      
          <h:outputText styleClass="headerText" value="Time" />
                                  
          </h:column>
                                  
          <h:column>
                                      
          <h:outputText styleClass="headerText" value="操作" />
                                  
          </h:column>                        
                              
          </rich:columnGroup>
                          
          </f:facet>
              
                          
          <h:column>
                              
          <h:outputText value="#{car.name}" />
                          
          </h:column>
                          
          <h:column>
                              
          <h:outputText value="#{car.description}" />
                          
          </h:column>
                          
          <h:column>
                              
          <h:outputText value="#{car.baseprice}" />
                          
          </h:column>
                          
          <h:column>
                              
          <h:outputText value="#{car.timestamp}" />
                          
          </h:column>
                          
          <h:column>
                              
          <h:commandLink action="#{user.delete}" value="刪除" >
                                  
          <f:param name="id" value="#{car.id}"/>
                              
          </h:commandLink>
                          
          </h:column>                
                      
          </rich:dataTable>
                      
          <rich:datascroller for="carList" id="dc1"
                      style
          ="width:483px" page="#{user.scrollerPage}"/>                        
                  
          </h:form>
              
          </f:view>

          DataPage.java(沒(méi)有變化):
          import java.util.List;

          public class DataPage
          {

              
          /**
               * 將需要的頁(yè)的數(shù)據(jù)封裝到一個(gè)DataPage中去, 這個(gè)類(lèi)表示了我們需要的一頁(yè)的數(shù)據(jù),<br>
               * 里面包含有三個(gè)元素:datasetSize,startRow,和一個(gè)用于表示具體數(shù)據(jù)的List。<br>
               * datasetSize表示了這個(gè)記錄集的總條數(shù),查詢數(shù)據(jù)的時(shí)候,使用同樣的條件取count即可,<br>
               * startRow表示該頁(yè)的起始行在數(shù)據(jù)庫(kù)中所有記錄集中的位置
               
          */


              
          private int datasetSize;

              
          private int startRow;

              
          private List data;

              
          /**
               * 
               * 
          @param datasetSize
               *            數(shù)據(jù)集大小
               * 
          @param startRow
               *            起始行
               * 
          @param data
               *            數(shù)據(jù)list
               
          */

              
          public DataPage(int datasetSize, int startRow, List data)
              
          {

                  
          this.datasetSize = datasetSize;

                  
          this.startRow = startRow;

                  
          this.data = data;

              }


              
          /**
               * 
               * 
          @return
               
          */

              
          public int getDatasetSize()
              
          {

                  
          return datasetSize;

              }


              
          public int getStartRow()
              
          {

                  
          return startRow;

              }


              
          /**
               * 
               * 
          @return 已填充好的數(shù)據(jù)集
               
          */

              
          public List getData()
              
          {

                  
          return data;

              }


          }


          PagedListDataModel.java(添加了一些注釋?zhuān)?
          package com.jsecode.util.pagination;

          import java.util.List;

          import javax.faces.model.DataModel;

          /**
           * 
           * TODO 分頁(yè)所使用的類(lèi)

           * 
          @author <a href="mailto:tianlu@jsecode.com">TianLu</a>
           * 
          @version $Rev$ <br>
           *          $Id$
           
          */

          /* 使用方法:
           * 前臺(tái)的功能模塊Bean(例如User)中繼承PageListBaseBean類(lèi),可根據(jù)您的需要進(jìn)行相應(yīng)修改
           * 前臺(tái)控件像這樣使用
           * <rich:dataTable id="carList" width="483" columnClasses="col" rows="#{user.pageSize}"
              value="#{user.defaultDataModel}" var="car">            
              <f:facet name="header">
                  <rich:columnGroup>
                      <h:column>
                          <h:outputText styleClass="headerText" value="Name" />
                      </h:column>
                      <h:column>
                          <h:outputText styleClass="headerText" value="Decription" />
                      </h:column>
                      <h:column>
                          <h:outputText styleClass="headerText" value="Base Price" />
                      </h:column>
                      <h:column>
                          <h:outputText styleClass="headerText" value="Time" />
                      </h:column>
                      <h:column>
                          <h:outputText styleClass="headerText" value="操作" />
                      </h:column>                        
                  </rich:columnGroup>
              </f:facet>

              <h:column>
                  <h:outputText value="#{car.name}" />
              </h:column>
              <h:column>
                  <h:outputText value="#{car.description}" />
              </h:column>
              <h:column>
                  <h:outputText value="#{car.baseprice}" />
              </h:column>
              <h:column>
                  <h:outputText value="#{car.timestamp}" />
              </h:column>
              <h:column>
                  <h:commandLink action="#{user.delete}" value="刪除" >
                      <f:param name="id" value="#{car.id}"/>
                  </h:commandLink>
              </h:column>                
          </rich:dataTable>
          <rich:datascroller for="carList" id="dc1"
          style="width:483px" page="#{user.scrollerPage}"/>
          */


          /*
           * 進(jìn)行刪除等操作后會(huì)立即改變列表項(xiàng)并且返回列表頁(yè)的,請(qǐng)調(diào)用本類(lèi)的refresh方法刷新當(dāng)前頁(yè)面
           * 使用方法:
           *             dao.delete(bean);
           *            dataModel.refresh();
           
          */

          public abstract class PagedListDataModel extends DataModel {
              
          int pageSize;
              
          int rowIndex;
              DataPage page;

              
          /**
               * Create a datamodel that pages through the data showing the specified
               * number of rows on each page.
               
          */

              
          public PagedListDataModel(int pageSize) {
                  
          super();
                  
          this.pageSize = pageSize;
                  
          this.rowIndex = -1;
                  
          this.page = null;
              }


              
          /**
               * Not used in this class; data is fetched via a callback to the fetchData
               * method rather than by explicitly assigning a list.
               
          */

              
          public void setWrappedData(Object o) {
                  
          if (o instanceof DataPage) {
                      
          this.page = (DataPage) o;
                  }
           else {
                      
          throw new UnsupportedOperationException(" setWrappedData ");
                  }

              }


              
          public int getRowIndex() {
                  
          return rowIndex;
              }


              
          /**
               * Specify what the "current row" within the dataset is. Note that the
               * UIData component will repeatedly call this method followed by getRowData
               * to obtain the objects to render in the table.
               
          */

              
          public void setRowIndex(int index) {
                  rowIndex 
          = index;
              }


              
          /**
               * Return the total number of rows of data available (not just the number of
               * rows in the current page!).
               
          */

              
          public int getRowCount() {
                  
          return getPage().getDatasetSize();
              }


              
          /**
               * Return a DataPage object; if one is not currently available then fetch
               * one. Note that this doesn't ensure that the datapage returned includes
               * the current rowIndex row; see getRowData.
               
          */

              
          private DataPage getPage() {
                  
          if (page != null{
                      
          return page;
                  }

                  
          int rowIndex = getRowIndex();
                  
          int startRow = rowIndex;
                  
          if (rowIndex == -1{
                      
          // even when no row is selected, we still need a page
                      
          // object so that we know the amount of data available.
                      startRow = 0;
                  }
           // invoke method on enclosing class
                  page = fetchPage(startRow, pageSize);
                  
          return page;
              }


              
          /**
               * Return the object corresponding to the current rowIndex. If the DataPage
               * object currently cached doesn't include that index then fetchPage is
               * called to retrieve the appropriate page.
               
          */

              
          public Object getRowData() {
                  
          if (rowIndex < 0{
                      
          throw new IllegalArgumentException(
                              
          " Invalid rowIndex for PagedListDataModel; not within page ");
                  }
           // ensure page exists; if rowIndex is beyond dataset size, then
                  
          // we should still get back a DataPage object with the dataset size
                  
          // in it
                  if (page == null{
                      page 
          = fetchPage(rowIndex, pageSize);
                  }

                  
          int datasetSize = page.getDatasetSize();
                  
          int startRow = page.getStartRow();
                  
          int nRows = page.getData().size();
                  
          int endRow = startRow + nRows;
                  
          if (rowIndex >= datasetSize) {
                      
          throw new IllegalArgumentException(" Invalid rowIndex ");
                  }

                  
          if (rowIndex < startRow) {
                      page 
          = fetchPage(rowIndex, pageSize);
                      startRow 
          = page.getStartRow();
                  }
           else if (rowIndex >= endRow) {
                      page 
          = fetchPage(rowIndex, pageSize);
                      startRow 
          = page.getStartRow();
                  }

                  
          return page.getData().get(rowIndex - startRow);
              }


              
          public Object getWrappedData() {
                  
          return page.getData();
              }


              
          /**
               * Return true if the rowIndex value is currently set to a value that
               * matches some element in the dataset. Note that it may match a row that is
               * not in the currently cached DataPage; if so then when getRowData is
               * called the required DataPage will be fetched by calling fetchData.
               
          */

              
          public boolean isRowAvailable() {
                  DataPage page 
          = getPage();
                  
          if (page == null{
                      
          return false;
                  }

                  
          int rowIndex = getRowIndex();
                  
          if (rowIndex < 0{
                      
          return false;
                  }
           else if (rowIndex >= page.getDatasetSize()) {
                      
          return false;
                  }
           else {
                      
          return true;
                  }

              }


              
          /**
               * Method which must be implemented in cooperation with the managed bean
               * class to fetch data on demand.
               
          */

              
          public abstract DataPage fetchPage(int startRow, int pageSize);

              
          /**
               * 進(jìn)行刪除等操作后會(huì)立即改變列表項(xiàng)并且返回列表頁(yè)的,請(qǐng)調(diào)用此方法,用于刷新列表。
               
          */

              
          public void refresh() {
                  
          if (this.page != null{
                      
          this.page = null;
                      getPage();
                  }

              }

          }



          新增加的PageListBaseBean.java文件,所有需要分頁(yè)的bean繼承此類(lèi),簡(jiǎn)化代碼:
          import com.jsecode.util.pagination.DataPage;
          import com.jsecode.util.pagination.PagedListDataModel;

          /*使用方法參考:
          public class User extends PageListBaseBean
          {
              @Override
              public PagedListDataModel getDefaultDataModel()
              {
                  if ( defaultDataModel == null ) {
                      defaultDataModel = new PagedListDataModel(pageSize)
                      {
                          public DataPage fetchPage(int startRow, int pageSize)
                          {
                              // call enclosing managed bean method to fetch the data
                              CarBeanDAO dao = new CarBeanDAO();
                              String sql = "from CarBean model order by model.id desc";                
                              Query query = EntityManagerHelper.createQuery(sql);                    
                              query.setFirstResult(startRow);                    
                              query.setMaxResults(pageSize);                    
                              List list = query.getResultList();
                              Query q = EntityManagerHelper.createQuery("select count(*) from CarBean");
                              return new DataPage(Integer.parseInt(q.getSingleResult().toString()), startRow, list);                    
                          }
                      };
                  }
                  
                  return defaultDataModel;
              }
          }
          * 如需添加多個(gè)分頁(yè)功能,請(qǐng)自定義PagedListDataModel變量和實(shí)現(xiàn)相關(guān)getXXXDataModel方法
          */

          /**
           * TODO 帶分頁(yè)功能的基類(lèi)
           * 
           * 
          @author <a href="mailto:tianlu@jsecode.com">TianLu</a>
           * 
          @version $Rev$ <br>
           *          $Id$
           
          */

          public abstract class PageListBaseBean {
              
          /**
               * 當(dāng)前頁(yè)碼,跟dataSroller的page屬性綁定
               
          */

              
          protected int scrollerPage = 1;
              
              
          /**
               * 當(dāng)前頁(yè)面大小
               
          */

              
          protected int pageSize = 10;
              
              
          /**
               * 默認(rèn)數(shù)據(jù)模型,如果你有多個(gè)數(shù)據(jù)集需要分頁(yè),請(qǐng)自定義PagedListDataModel和相應(yīng)的getDataModel方法
               
          */

              
          protected PagedListDataModel defaultDataModel;
              
              
          public int getScrollerPage()
              
          {
                  
          return scrollerPage;
              }


              
          public void setScrollerPage(int scrollerPage)
              
          {
                  
          this.scrollerPage = scrollerPage;
              }

              
              
          public int getPageSize()
              
          {
                  
          return pageSize;
              }


              
          public void setPageSize(int pageSize)
              
          {
                  
          this.pageSize = pageSize;
              }

              
              
          public abstract PagedListDataModel getDefaultDataModel();


          }



          User中的delete方法:
              public String delete()
              
          {
                  FacesContext ctx 
          = FacesContext.getCurrentInstance();
                  
          int id = Integer.parseInt(ctx.getExternalContext().getRequestParameterMap().get("id"));
                  EntityManagerHelper.beginTransaction();
                  CarBeanDAO dao 
          = new CarBeanDAO();
                  CarBean bean 
          = dao.findById(id);
                  
          if(bean != null)
                  
          {            
                      dao.delete(bean);
                      dataModel.refresh();
                  }

                      
                  EntityManagerHelper.commit();
                  
          return null;
              }

          Faces-config.xml:
           <managed-bean>
            
          <managed-bean-name>user</managed-bean-name>
            
          <managed-bean-class>com.gcoresoft.jsfdemo.bean.User</managed-bean-class>
            
          <managed-bean-scope>session</managed-bean-scope>
           
          </managed-bean>

          有人反映會(huì)出現(xiàn)獲取兩次DataModel的情況,為什么呢?
          經(jīng)過(guò)我的測(cè)試,是因?yàn)樵O(shè)置的datatable的rows屬性的值大于了程序中pageSize的值,比如你設(shè)置rows="12",而你的pageSize設(shè)置的是10,那么JSF為了滿足顯示12條得條件,就會(huì)取兩次數(shù)據(jù)集組成一個(gè)12跳得數(shù)據(jù)集顯示出來(lái),所以給定的rows屬性最好可以使用相關(guān)管理bean的pageSize變量,這樣前后臺(tái)統(tǒng)一數(shù)據(jù)條目,提高性能和可操作性。

          為了方便大家JSF的項(xiàng)目開(kāi)發(fā),后面我會(huì)推出一套我自己寫(xiě)的一個(gè)基于JSF的框架,當(dāng)然此框架是基于實(shí)際項(xiàng)目成功實(shí)施后提取出來(lái)的,主要是簡(jiǎn)化了對(duì)表單的操作,增加一些常用的工具套件,例如分頁(yè),驗(yàn)證器等等。對(duì)表單操作部分的簡(jiǎn)化主要體現(xiàn)在:每種控件都可以和固定的模型綁定,這樣操作模型就可以做到對(duì)前臺(tái)控件的控制,比如后臺(tái)取值可以使用attributes.get("username"),設(shè)置前臺(tái)控件值可以使用attributes.put("username","admin"),對(duì)選擇控件操作也更加簡(jiǎn)便,當(dāng)使用put的方法的時(shí)候,前臺(tái)會(huì)自動(dòng)選擇到那項(xiàng),更重要的是這些簡(jiǎn)化不需要你寫(xiě)程序代碼,寫(xiě)一些簡(jiǎn)單的配置文件即可,而且選擇項(xiàng)不僅可以設(shè)置在配置文件中,還可以通過(guò)數(shù)據(jù)庫(kù)等其他數(shù)據(jù)源獲取,大大提高開(kāi)發(fā)效率。

          ---------------------------------------------------------
          專(zhuān)注移動(dòng)開(kāi)發(fā)

          Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
          posted on 2008-11-04 19:57 TiGERTiAN 閱讀(3765) 評(píng)論(11)  編輯  收藏 所屬分類(lèi): JavaJSF

          評(píng)論:
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2008-11-05 10:13 | 千里冰封
          怎么編碼風(fēng)格不一致,有些在大擴(kuò)號(hào)在行的最后面,有些是大括號(hào)另起一行的。  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2008-11-05 13:15 | TiGERTiAN
          @千里冰封
          不好意思哦,有的是我自己的編碼風(fēng)格,有的是用了格式化工具格式化過(guò)的。  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2008-11-08 15:27 | ci
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2009-07-08 15:47 | Riverelt
          樓主幫了我大忙了!實(shí)在是感謝~!  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-03-16 01:28 | Abby
          我在JSF中就是用的你以上的方法,可是還是有一個(gè)很大的問(wèn)題!比如:我現(xiàn)按照數(shù)據(jù)5條來(lái)分頁(yè),數(shù)據(jù)庫(kù)中一共有11條數(shù)據(jù),那么我的fetchPage()方法卻被調(diào)用了3次后,開(kāi)始報(bào)錯(cuò)!如下:
          in getUserByPage Now!!
          PagedListDataModel!!
          1莉莉女19830101
          10hhhfemale19630302
          11ttmale19630302
          2大飛男19800202
          3Tinafemale19000203
          count=11
          rowIndex=0
          startRow=0
          rowIndex=1
          startRow=0
          rowIndex=2
          startRow=0
          rowIndex=3
          startRow=0
          rowIndex=4
          startRow=0
          PagedListDataModel!!
          3Tinafemale19000203
          count=11
          rowIndex=5
          startRow=5
          PagedListDataModel!!
          count=11
          rowIndex=6
          startRow=6
          2010-3-15 17:36:06 com.sun.facelets.FaceletViewHandler handleRenderException
          嚴(yán)重: Error Rendering View[/listPage.xhtml]
          java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
          at java.util.ArrayList.RangeCheck(Unknown Source)
          at java.util.ArrayList.get(Unknown Source)
          at demo.PagedListDataModel.getRowData(PagedListDataModel.java:83)
          at org.ajax4jsf.model.SequenceDataModel.getRowData(SequenceDataModel.java:147)
          at org.richfaces.model.ModifiableModel$RowKeyWrapperFactory.wrapObject(ModifiableModel.java:75)
          at org.richfaces.model.impl.expressive.ObjectWrapperFactory$2.convert(ObjectWrapperFactory.java:190)
          at org.richfaces.model.impl.expressive.ObjectWrapperFactory.convertList(ObjectWrapperFactory.java:151)
          at org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapList(ObjectWrapperFactory.java:188)
          at org.richfaces.model.ModifiableModel.filter(ModifiableModel.java:252)
          at org.richfaces.model.ModifiableModel.modify(ModifiableModel.java:240)
          at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:140)
          at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
          at org.ajax4jsf.component.UIDataAdaptor.getRowCount(UIDataAdaptor.java:248)
          at org.richfaces.component.UIDatascroller.getRowCount(UIDatascroller.java:362)
          at org.richfaces.component.UIDatascroller.setupFirstRowValue(UIDatascroller.java:452)
          at org.richfaces.component.RenderPhaseDataScrollerVisitor.afterRoot(RenderPhaseDataScrollerVisitor.java:191)
          at org.richfaces.event.RenderPhaseComponentListener.beforePhase(RenderPhaseComponentListener.java:73)
          at org.ajax4jsf.component.AjaxViewRoot.processPhaseListeners(AjaxViewRoot.java:183)
          at org.ajax4jsf.component.AjaxViewRoot.encodeBegin(AjaxViewRoot.java:505)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
          at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594)
          at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
          at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
          請(qǐng)指教??  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-03-16 01:34 | Abby

          public class UsePage extends PageListBaseBean{

          ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
          IUserDAO userDAO = (UserDAO)context.getBean("userDao");


          //private IUserService userService;

          private User user; // 當(dāng)前對(duì)象

          private String operation; // 操作標(biāo)識(shí)符




          public UsePage() {
          datas = new ArrayList<User>();
          }

          public User getUser() {
          return user;
          }

          public void setUser(User user) {
          this.user = user;
          }



          public void setDatas(List<User> datas) {
          this.datas = datas;
          }

          public String getOperation() {
          return operation;
          }

          public void setOperation(String operation) {
          this.operation = operation;
          }



          /**
          * 分頁(yè)查詢記錄
          */



          public String getUserByPage(){


          defaultDataModel = this.getDefaultDataModel();
          System.out.println("in getUserByPage Now!!");
          return "listPage";
          }


          @Override
          public PagedListDataModel getDefaultDataModel() {
          // TODO Auto-generated method stub
          if ( defaultDataModel == null ) {
          defaultDataModel = new PagedListDataModel(pageSize)
          {

          public DataPage fetchPage(int startRow, int pageSize)
          {
          System.out.println("PagedListDataModel!!");
          Map<String,Integer> pageMap = new HashMap<String,Integer>();
          pageMap.put("start",startRow);
          pageMap.put("end",pageSize);
          //IUserDAO userDAO = (UserDAO)context.getBean("userDao");
          List list= userDAO.getUserByPage(pageMap);
          for(int i=0;i<list.size();i++){
          User user = new User();
          user = (User) list.get(i);
          System.out.print(user.getId());
          System.out.print(user.getName());
          System.out.print(user.getSex());
          System.out.println(user.getBirthday());
          }
          int count = userDAO.getCount();
          System.out.println("count="+count);
          return new DataPage(count, startRow, list);
          }
          };
          }
          return defaultDataModel;}

          }其他代碼都是一樣的,就是這個(gè)地方不一樣!!  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-03-16 13:08 | TiGERTiAN
          明顯數(shù)據(jù)沒(méi)有取到,你最好檢查一下。  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-03-17 22:26 | Abby
          數(shù)據(jù)是取到了的,頁(yè)面顯示的就是我的pagesize規(guī)定的條數(shù)。可是問(wèn)題是,我的<rich:datascroller>失效了,點(diǎn)擊上一頁(yè)、下一頁(yè)都沒(méi)有一點(diǎn)反映,頁(yè)碼也沒(méi)有顯示出來(lái)??這是什么原因呢??  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-03-17 22:43 | Abby
          我的頁(yè)面的內(nèi)容以及寫(xiě)法,和你上面寫(xiě)的頁(yè)面的代碼是一樣的,我采用的是xhtml的頁(yè)面,可是結(jié)果卻是上面提到的那樣,實(shí)在不知道原因,請(qǐng)給點(diǎn)建議??謝謝!!  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-04-06 17:17 | luoyf
          我和Abby碰到的情況一樣,<rich:datascroller>失效了,點(diǎn)擊下一頁(yè)只跳到第二頁(yè)就不動(dòng)了;點(diǎn)擊上一頁(yè),不管當(dāng)前是幾頁(yè),都是直接跳到第一頁(yè)。求救...  回復(fù)  更多評(píng)論
            
          # re: 【第三版】RichFaces中使用datatable和datascroller進(jìn)行分頁(yè)(使用數(shù)據(jù)庫(kù)分頁(yè),改良版)(含源碼)(JSF 1.2,RichFaces 3.2.1GA) 2010-04-06 19:11 | TiGERTiAN
          @luoyf
          你們debug一下呢,一年多前寫(xiě)的東西,我已經(jīng)記的不太清楚了。  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 柳州市| 三亚市| 法库县| 萨嘎县| 凤冈县| 梅州市| 怀远县| 承德县| 秭归县| 土默特左旗| 安仁县| 牟定县| 鄂温| 盐山县| 芜湖县| 沈阳市| 凤阳县| 南汇区| 巍山| 康平县| 洛南县| 腾冲县| 桐乡市| 沙田区| 越西县| 长汀县| 台北县| 荆门市| 吴堡县| 荣成市| 高陵县| 锡林郭勒盟| 新邵县| 石林| 通州市| 兴海县| 寻乌县| 贺州市| 来宾市| 曲麻莱县| 阜新|