ITeye博客

jsf实现翻页

fourfire · 2007-09-17 16:25 · Java · Markdown

用jsf实现了翻页功能,主要原理是扩展datamodel和datatabletag
1 扩展datatabletag,增加了几个属性,用于后台执行查询语句

java 代码

 

  1. package com.longtop.core.web.jsf.tag;
  2. import javax.faces.application.Application;
  3. import javax.faces.component.UIComponent;
  4. import javax.faces.context.FacesContext;
  5. import javax.faces.el.ValueBinding;
  6. import com.sun.faces.taglib.html_basic.DataTableTag;
  7. public class DataTableWithScrollTag extends DataTableTag {
  8. private boolean scroll = true;
  9. private int pageSize = 10;
  10. private String scrollPageCss = "";
  11. private String moduleId;
  12. private String statementId;
  13. private String beanName;
  14. private String implType;
  15. private String searchCondition;
  16. /**
  17. * @return the pageSize
  18. */
  19. public int getPageSize() {
  20. return pageSize;
  21. }
  22. /**
  23. * @param pageSize
  24. *            the pageSize to set
  25. */
  26. public void setPageSize(int pageSize) {
  27. this.pageSize = pageSize;
  28. }
  29. /**
  30. * @return the scroll
  31. */
  32. public boolean isScroll() {
  33. return scroll;
  34. }
  35. /**
  36. * @param scroll
  37. *            the scroll to set
  38. */
  39. public void setScroll(boolean scroll) {
  40. this.scroll = scroll;
  41. }
  42. public String getComponentType() {
  43. return "com.longtop.core.web.jsf.render.DataTableWithScrollType";
  44. }
  45. public void setProperties(UIComponent component) {
  46. super.setProperties(component);
  47. setStringProperty(component, "pageSize", String.valueOf(pageSize));
  48. setStringProperty(component, "scroll", String.valueOf(scroll));
  49. setStringProperty(component, "scrollPageCss", scrollPageCss);
  50. setStringProperty(component, "moduleId", moduleId);
  51. setStringProperty(component, "statementId", statementId);
  52. setStringProperty(component, "beanName", beanName);
  53. setStringProperty(component, "implType", implType);
  54. setStringProperty(component, "searchCondition", searchCondition);
  55. }
  56. private void setStringProperty(UIComponent component, String attrName,
  57. String attrValue) {
  58. if (attrValue == null)
  59. return;
  60. if (isValueReference(attrValue)) {
  61. FacesContext context = FacesContext.getCurrentInstance();
  62. Application application = context.getApplication();
  63. ValueBinding binding = application.createValueBinding(attrValue);
  64. component.setValueBinding(attrName, binding);
  65. } else {
  66. component.getAttributes().put(attrName, attrValue);
  67. }
  68. }
  69. /**
  70. * @return the scrollPageCss
  71. */
  72. public String getScrollPageCss() {
  73. return scrollPageCss;
  74. }
  75. /**
  76. * @param scrollPageCss the scrollPageCss to set
  77. */
  78. public void setScrollPageCss(String scrollPageCss) {
  79. this.scrollPageCss = scrollPageCss;
  80. }
  81. /**
  82. * @return the moduleId
  83. */
  84. public String getModuleId() {
  85. return moduleId;
  86. }
  87. /**
  88. * @param moduleId the moduleId to set
  89. */
  90. public void setModuleId(String moduleId) {
  91. this.moduleId = moduleId;
  92. }
  93. /**
  94. * @return the statementId
  95. */
  96. public String getStatementId() {
  97. return statementId;
  98. }
  99. /**
  100. * @param statementId the statementId to set
  101. */
  102. public void setStatementId(String statementId) {
  103. this.statementId = statementId;
  104. }
  105. /**
  106. * @return the beanName
  107. */
  108. public String getBeanName() {
  109. return beanName;
  110. }
  111. /**
  112. * @param beanName the beanName to set
  113. */
  114. public void setBeanName(String beanName) {
  115. this.beanName = beanName;
  116. }
  117. /**
  118. * @return the implType
  119. */
  120. public String getImplType() {
  121. return implType;
  122. }
  123. /**
  124. * @param implType the implType to set
  125. */
  126. public void setImplType(String implType) {
  127. this.implType = implType;
  128. }
  129. /**
  130. * @return the searchCondition
  131. */
  132. public String getSearchCondition() {
  133. return searchCondition;
  134. }
  135. /**
  136. * @param searchCondition the searchCondition to set
  137. */
  138. public void setSearchCondition(String searchCondition) {
  139. this.searchCondition = searchCondition;
  140. }
  141. }

2 dragon.tld

xml 代码

 

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE taglib
  3. PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
  4. "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
  5. <taglib>
  6. <tlib-version>1.0</tlib-version>
  7. <jsp-version>2.0</jsp-version>
  8. <short-name>d</short-name>
  9. <uri>http://com.longtop.net/dataTableWithScroll</uri>
  10. <tag>
  11. <name>scrollDataTable</name>
  12. <tag-class>com.longtop.core.web.jsf.tag.DataTableWithScrollTag</tag-class>
  13. <tei-class>com.sun.faces.taglib.FacesTagExtraInfo</tei-class>
  14. <body-content>JSP</body-content>
  15. <description>
  16. </description>
  17. <attribute>
  18. <name>first</name>
  19. <required>false</required>
  20. <rtexprvalue>false</rtexprvalue>
  21. <description>
  22. Zero-relative row number of the first row to be displayed.  If this
  23. property is set to zero, rendering will begin with the first row of
  24. the underlying data.
  25. </description>
  26. </attribute>
  27. <attribute>
  28. <name>id</name>
  29. <required>false</required>
  30. <rtexprvalue>false</rtexprvalue>
  31. <description>
  32. The component identifier for this component.  This value must be
  33. unique within the closest parent component that is a naming
  34. container.
  35. </description>
  36. </attribute>
  37. <attribute>
  38. <name>rendered</name>
  39. <required>false</required>
  40. <rtexprvalue>false</rtexprvalue>
  41. <description>
  42. Flag indicating whether or not this component should be rendered
  43. (during Render Response Phase), or processed on any subsequent
  44. form submit.
  45. </description>
  46. </attribute>
  47. <attribute>
  48. <name>rows</name>
  49. <required>false</required>
  50. <rtexprvalue>false</rtexprvalue>
  51. <description>
  52. The number of rows to display, starting with the one identified by the
  53. "first" property.  If this value is set to zero, all available rows in
  54. the underlying data model will be displayed.
  55. </description>
  56. </attribute>
  57. <attribute>
  58. <name>value</name>
  59. <required>false</required>
  60. <rtexprvalue>false</rtexprvalue>
  61. <description>
  62. The current value of this component.
  63. </description>
  64. </attribute>
  65. <attribute>
  66. <name>var</name>
  67. <required>false</required>
  68. <rtexprvalue>false</rtexprvalue>
  69. <description>
  70. Name of a request-scope attribute under which the model data for the
  71. row selected by the current value of the "rowIndex" property (i.e.
  72. also the current value of the "rowData" property) will be exposed.
  73. </description>
  74. </attribute>
  75. <attribute>
  76. <name>bgcolor</name>
  77. <required>false</required>
  78. <rtexprvalue>false</rtexprvalue>
  79. <description>
  80. Name or code of the background color for this table.
  81. </description>
  82. </attribute>
  83. <attribute>
  84. <name>border</name>
  85. <required>false</required>
  86. <rtexprvalue>false</rtexprvalue>
  87. <description>
  88. Width (in pixels) of the border to be drawn
  89. around this table.
  90. </description>
  91. </attribute>
  92. <attribute>
  93. <name>cellpadding</name>
  94. <required>false</required>
  95. <rtexprvalue>false</rtexprvalue>
  96. <description>
  97. Definition of how much space the user agent should
  98. leave between the border of each cell and its contents.
  99. </description>
  100. </attribute>
  101. <attribute>
  102. <name>cellspacing</name>
  103. <required>false</required>
  104. <rtexprvalue>false</rtexprvalue>
  105. <description>
  106. Definition of how much space the user agent should
  107. leave between the left side of the table and the
  108. leftmost column, the top of the table and the top of
  109. the top side of the topmost row, and so on for the
  110. right and bottom of the table.  It also specifies
  111. the amount of space to leave between cells.
  112. </description>
  113. </attribute>
  114. <attribute>
  115. <name>columnClasses</name>
  116. <required>false</required>
  117. <rtexprvalue>false</rtexprvalue>
  118. <description>
  119. Comma-delimited list of CSS style classes that will be applied
  120. to the columns of this table.  A space separated list of
  121. classes may also be specified for any individual column.  If
  122. the number of elements in this list is less than the number of
  123. columns specified in the "columns" attribute, no "class"
  124. attribute is output for each column greater than the number of
  125. elements in the list.  If the number of elements in the list
  126. is greater than the number of columns specified in the
  127. "columns" attribute, the elements at the posisiton in the list
  128. after the value of the "columns" attribute are ignored.
  129. </description>
  130. </attribute>
  131. <attribute>
  132. <name>dir</name>
  133. <required>false</required>
  134. <rtexprvalue>false</rtexprvalue>
  135. <description>
  136. Direction indication for text that does not inherit directionality.
  137. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left).
  138. </description>
  139. </attribute>
  140. <attribute>
  141. <name>footerClass</name>
  142. <required>false</required>
  143. <rtexprvalue>false</rtexprvalue>
  144. <description>
  145. Space-separated list of CSS style class(es) that will be
  146. applied to any footer generated for this table.
  147. </description>
  148. </attribute>
  149. <attribute>
  150. <name>frame</name>
  151. <required>false</required>
  152. <rtexprvalue>false</rtexprvalue>
  153. <description>
  154. Code specifying which sides of the frame surrounding
  155. this table will be visible.  Valid values are:
  156. none (no sides, default value); above (top side only);
  157. below (bottom side only); hsides (top and bottom sides
  158. only); vsides (right and left sides only); lhs (left
  159. hand side only); rhs (right hand side only); box
  160. (all four sides); and border (all four sides).
  161. </description>
  162. </attribute>
  163. <attribute>
  164. <name>headerClass</name>
  165. <required>false</required>
  166. <rtexprvalue>false</rtexprvalue>
  167. <description>
  168. Space-separated list of CSS style class(es) that will be
  169. applied to any header generated for this table.
  170. </description>
  171. </attribute>
  172. <attribute>
  173. <name>lang</name>
  174. <required>false</required>
  175. <rtexprvalue>false</

评论(10)

  1. #10 楼 · fishhappy365 · 2008-01-15 10:12

    大哥:能给我你这个工程的源代码码?如果可以的话,发到我邮箱中,我的邮箱地址是: fishhappy365@163.com

  2. #9 楼 · fishhappy365 · 2008-01-14 20:08

    大哥:DataTableTag 是final类型的,这个你也能继承?

  3. #8 楼 · -妞- · 2007-11-22 14:11

    dragon.tld 文件没帖完整,能否帖完整啊?

    我也正在用jsf 做分页,可否把你的完整代码发给我啊?

  4. #7 楼 · gapele · 2007-09-30 13:58

    :) 直接用Myfaces的实现岂不是更方便!

  5. #6 楼 · fourfire · 2007-09-21 14:31

    谢谢你的回复,我有以下考虑 1 我需要提供多种扩充的查询条件的方式,这是一种,这样的话就可以共用后台一个主查询语句了 也可以实现IScrollDataLoad在后台进行条件添加 2 页面上还有用js添加运行期条件的方法 如books2_condition_txt 这样有些模块就不用为了一个条件的变化而写很多的dao方法了,查询业务,简单一些为好

  6. #5 楼 · john.yi · 2007-09-19 20:01

    <d:scrollDataTable id="books2"

    value="#{TestBean.otherDataModel}" pageSize="10" var="store2" scroll="true" moduleId="tools" statementId="ChineseLetter" beanName="queryHibernate" searchCondition="obj.id like '%A%'" implType="hibernate">

    个人不太喜欢这种方式 条件都在页面里了 直接加个总页数,绑定到DataModel(只有一页数据)是否好用些呢

  7. #4 楼 · fourfire · 2007-09-17 16:33

    测试页面(hibernate实现)

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
     <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
     <%@ taglib uri="/WEB-INF/tld/dragon.tld" prefix="d" %>
    
            <style type="text/css">
                body { font: 11px Lucida Grande, Verdana, Arial, Helvetica, sans serif; }
                #progressBar { padding-top: 5px; }
                #progressBarBox { width: 350px; height: 20px; border: 1px inset; background: #eee;}
                #progressBarBoxContent { width: 0; height: 20px; border-right: 1px solid #444; background: #9ACB34; }
                td{border: 1px solid #333;text-align:center;}
                 tr{border: 1px solid #333;text-align:center;}
            </style>
        
    <f:view>
        
     <h:form>
    <d:scrollDataTable id="books2"
      value="#{TestBean.otherDataModel}" pageSize="10" var="store2" scroll="true" moduleId="tools" statementId="ChineseLetter" beanName="queryHibernate" searchCondition="obj.id like '%A%'" implType="hibernate">   
     <h:column>
        <f:facet name="header">
          <h:outputText  value="A"/>
        </f:facet>
         <h:outputText value="#{store2.id}"/>
      </h:column>
      <h:column>
       
         <h:outputText value="#{store2.letter}"/>
      </h:column>
      <h:column>
        <f:facet name="header">
          <h:outputText  value="B"/>
        </f:facet>
         <h:outputText value="#{store2.chinese}"/>
      </h:column>
    </d:scrollDataTable> 
    <input type="button" onclick="document.getElementById('_id0:books2_condition_txt').value='obj.letter like \'%1%\'';alert('');" value="setValue">
     </h:form>
         
     </f:view>
    </body>
    </html>
    
  8. #3 楼 · fourfire · 2007-09-17 16:32

    解码器

    package com.longtop.core.web.jsf.render;
    
    import java.io.IOException;
    
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    
    import com.longtop.core.web.jsf.model.ScrollDataModel;
    
    public class DataTableWithScroll extends
    		javax.faces.component.html.HtmlDataTable {
    
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see javax.faces.component.UIData#encodeBegin(javax.faces.context.FacesContext)
    	 */
    	@Override
    	public void encodeBegin(FacesContext context) throws IOException {
    
    		String clientId = getClientId(context);
    
    		String currentPage = (String) context.getExternalContext()
    				.getRequestParameterMap().get(clientId + "_txt");
    		String searchCondition_dynamic = (String) context.getExternalContext()
    		.getRequestParameterMap().get(clientId + "_condition_txt");
    		ScrollDataModel dataModel = (ScrollDataModel) this.getValue();
    		dataModel.setImplType((String) this.getAttributes().get("implType"));
    		dataModel.setBeanName((String) this.getAttributes().get("beanName"));
    
    		dataModel.setStatementId((String) this.getAttributes().get(
    				"statementId"));
    		dataModel.setModuleId((String) this.getAttributes().get("moduleId"));
    		if (currentPage == null || currentPage.trim().length() == 0) {
    			dataModel.setCurrentPage(0);
    		} else {
    			dataModel.setCurrentPage(Integer.parseInt(currentPage));
    		}
    		String searchCondition_static=(String) this.getAttributes().get("searchCondition");
    		dataModel.setQueryParam(((searchCondition_static==null||searchCondition_static.trim().length()==0)?"":searchCondition_static)+((searchCondition_dynamic==null||searchCondition_dynamic.trim().length()==0)?" ":" and "+searchCondition_dynamic));
    		dataModel.loadData();
    
    		super.encodeBegin(context);
    	}
    
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
    	 */
    	@Override
    	public void decode(FacesContext context) {
    		super.decode(context);
    
    	}
    
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext)
    	 */
    	@Override
    	public void encodeEnd(FacesContext context) throws IOException {
    
    		super.encodeEnd(context);
    
    		ResponseWriter writer = context.getResponseWriter();
    		try {
    
    			ScrollDataModel dataModel = (ScrollDataModel) this.getValue();
    
    			String clientId = getClientId(context);
    
    			writer.startElement("div", this);
    			writer.writeAttribute("class", this.getAttributes().get(
    					"scrollPageCss"), null);
    			writer.writeAttribute("name", clientId + "_div", null);
    			writer.writeAttribute("id", clientId + "_div", null);
    			// 当前页
    			String currentPage = (String) context.getExternalContext()
    					.getRequestParameterMap().get(clientId + "_txt");
    			writer.startElement("input", this);
    			writer.writeAttribute("name", clientId + "_txt", null);
    			writer.writeAttribute("id", clientId + "_txt", null);
    			writer.writeAttribute("type", "hidden", null);
    			writer.writeAttribute("value", "" + currentPage, null);
    			writer.endElement("input");
    			// 查询条件
    			String searchCondition_dynamic = (String) context.getExternalContext()
    					.getRequestParameterMap().get(clientId + "_condition_txt");
    			writer.startElement("input", this);
    			writer.writeAttribute("name", clientId + "_condition_txt", null);
    			writer.writeAttribute("id", clientId + "_condition_txt", null);
    			writer.writeAttribute("type", "hidden", null);
    			writer.writeAttribute("value", "" + ((searchCondition_dynamic==null||searchCondition_dynamic.trim().length()==0)?"":searchCondition_dynamic), null);
    			writer.endElement("input");
    			
    
    			writer.startElement("a", this);
    			writer.writeAttribute("href", "javascript:scrollPage(0)", null);
    			writer.writeText("首页", null);
    			writer.endElement("a");
    			writer.writeText(" ", null);
    			if (dataModel.getCurrentPage() == 0) {
    				writer.writeText("上一页", null);
    			} else {
    				writer.startElement("a", this);
    				writer.writeAttribute("href", "javascript:scrollPage("
    						+ (dataModel.getCurrentPage() - 1) + ")", null);
    				writer.writeText("上一页", null);
    				writer.endElement("a");
    			}
    			writer.writeText(" ", null);
    
    			if (dataModel.getCurrentPage() == ((dataModel.getRowTotalCount() / dataModel
    					.getRowsInPage()))) {
    				writer.writeText("下一页", null);
    			} else {
    				writer.startElement("a", this);
    				writer.writeAttribute("href", "javascript:scrollPage("
    						+ (dataModel.getCurrentPage() + 1) + ")", null);
    				writer.writeText("下一页", null);
    				writer.endElement("a");
    			}
    			writer.writeText(" ", null);
    
    			writer.startElement("a", this);
    			writer.writeAttribute("href", "javascript:scrollPage("
    					+ ((dataModel.getRowTotalCount() / dataModel
    							.getRowsInPage())) + ")", null);
    			writer.writeText("末页", null);
    			writer.endElement("a");
    			writer.writeText(" ", null);
    
    			writer.startElement("a", this);
    			writer.writeText("共" + dataModel.getRowTotalCount() + "条记录", null);
    			writer.endElement("a");
    			writer.endElement("div");
    
    			writer.startElement("script", this);
    			writer.writeAttribute("language", "javascript", null);
    			writer.writeText("function scrollPage(p){document.getElementById('"
    					+ clientId + "_txt').value=p;"
    					+ "document.getElementById('" + clientId
    					+ "_txt').form.submit();}", null);
    			writer.endElement("script");
    
    		} catch (IOException e) {
    
    			e.printStackTrace();
    		}
    	}
    
    }
    
    
  9. #2 楼 · fourfire · 2007-09-17 16:32

    model层

    package com.longtop.core.web.jsf.model;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import javax.faces.model.DataModel;
    
    public class ScrollDataModel extends DataModel {
    	/**
    	 * 总行数
    	 */
    	private long rowTotalCount;
    
    	/**
    	 * 当前页
    	 */
    	private int currentPage=0;
    
    	/**
    	 * 每页行数
    	 */
    	private int rowsInPage=10;
    
    	private int rowIndex;
    	private List data=new ArrayList();
    	private String moduleId;
    	private String beanName;
    	private String statementId;
    	private Object queryParam;
    	/**
    	 * 接口实现方式
    	 */
    	private String implType;
    	/**
    	 * IBATIS
    	 */
    	public static final  String IMPLTYPE_IBATIS="ibatis";
    	/**
    	 * HIBERNATE
    	 */
    	public static final  String IMPLTYPE_HIBERNATE="hibernate";
    	public ScrollDataModel()
    	{
    		super();
    		
    	}
    	public void loadData()
    	{
    		IScrollDataLoad loader=null;
    		data.clear();
    		
    		if(this.getImplType().toLowerCase().equals(IMPLTYPE_IBATIS))
    		{
    			loader=new DefaultScrollDataLoaderIBatisImpl();
    						
    		}else if(this.getImplType().toLowerCase().equals(IMPLTYPE_HIBERNATE))
    		{
    			loader=new DefaultScrollDataLoaderHibernateImpl();
    			
    		}
    		else{
    			try {
    				loader=(IScrollDataLoad) Class.forName(moduleId).newInstance();
    			} catch (InstantiationException e) {
    				
    				e.printStackTrace();
    			} catch (IllegalAccessException e) {
    				
    				e.printStackTrace();
    			} catch (ClassNotFoundException e) {
    				
    				e.printStackTrace();
    			}
    		}
    		data.addAll(loader.loadData(moduleId,beanName,statementId, queryParam, currentPage*rowsInPage, rowsInPage));
    
    		
    		rowTotalCount=loader.loadDataTotalCount(moduleId,beanName,statementId, queryParam);
    		
    	}
    
    	/**
    	 * @return the currentPage
    	 */
    	public int getCurrentPage() {
    		return currentPage;
    	}
    
    	/**
    	 * @param currentPage
    	 *            the currentPage to set
    	 */
    	public void setCurrentPage(int currentPage) {
    		this.currentPage = currentPage;
    	}
    
    	/**
    	 * @return the pageCount
    	 */
    	public long getRowTotalCount() {
    		return rowTotalCount;
    	}
    
    	/**
    	 * @param pageCount
    	 *            the pageCount to set
    	 */
    	public void setRowTotalCount(long rowTotalCount) {
    		this.rowTotalCount = rowTotalCount;
    	}
    
    	/**
    	 * @return the rowsInPage
    	 */
    	public int getRowsInPage() {
    		return rowsInPage;
    	}
    
    	/**
    	 * @param rowsInPage
    	 *            the rowsInPage to set
    	 */
    	public void setRowsInPage(int rowsInPage) {
    		this.rowsInPage = rowsInPage;
    	}
    
    	@Override
    	public int getRowCount() {
    		
    		return data.size();
    	}
    
    	@Override
    	public Object getRowData() {
    		
    		return data.get(this.getRowIndex());
    	}
    
    	@Override
    	public int getRowIndex() {
    		
    		return rowIndex;
    	}
    
    	@Override
    	public Object getWrappedData() {
    		return data.get(this.getRowIndex());
    	}
    
    	@Override
    	public boolean isRowAvailable() {
    		
    		if(this.getRowIndex()<data.size()&&this.getRowIndex()>-1) return true;
    		return false;
    	}
    
    	@Override
    	public void setRowIndex(int arg0) {
    		rowIndex=arg0;
    		
    	}
    
    	@Override
    	public void setWrappedData(Object arg0) {
    		 data.set(this.getRowIndex(),arg0);
    		
    	}
    
    	/**
    	 * @return the beanName
    	 */
    	public String getBeanName() {
    		return beanName;
    	}
    
    	/**
    	 * @param beanName the beanName to set
    	 */
    	public void setBeanName(String beanName) {
    		this.beanName = beanName;
    	}
    
    	/**
    	 * @return the data
    	 */
    	public List getData() {
    		return data;
    	}
    
    	/**
    	 * @param data the data to set
    	 */
    	public void setData(List data) {
    		this.data = data;
    	}
    
    	/**
    	 * @return the moduleId
    	 */
    	public String getModuleId() {
    		return moduleId;
    	}
    
    	/**
    	 * @param moduleId the moduleId to set
    	 */
    	public void setModuleId(String moduleId) {
    		this.moduleId = moduleId;
    	}
    
    	/**
    	 * @return the queryParam
    	 */
    	public Object getQueryParam() {
    		return queryParam;
    	}
    
    	/**
    	 * @param queryParam the queryParam to set
    	 */
    	public void setQueryParam(Object queryParam) {
    		this.queryParam = queryParam;
    	}
    
    	/**
    	 * @return the statementId
    	 */
    	public String getStatementId() {
    		return statementId;
    	}
    
    	/**
    	 * @param statementId the statementId to set
    	 */
    	public void setStatementId(String statementId) {
    		this.statementId = statementId;
    	}
    
    	/**
    	 * @return the implType
    	 */
    	public String getImplType() {
    		return implType;
    	}
    
    	/**
    	 * @param implType the implType to set
    	 */
    	public void setImplType(String implType) {
    		this.implType = implType;
    	}
    
    }
    
    
  10. #1 楼 · fourfire · 2007-09-17 16:31

    数据载入接口

    
    /**
     * <p>Description:ltCore</p>
     * <p>Copyright: Copyright (c) 2007</p>
     * <p>Company: LongTop</p>
     * @author blaze
     * @version 1.0
     */
    package com.longtop.core.web.jsf.model;
    
    /**
     * 翻页的数据检索接口,包括获得当前页数据,和获得数据总数两个方法
     */
    public interface IScrollDataLoad {
    
    	/**
    	 * 获得当前页数据
    	 * 
    	 * @param moduleId 模块id
    	 * @param beanName bean名称
    	 * @param statementId 语句id
    	 * @param queryParam
    	 *            查询条件
    	 * @param startIndex
    	 *            开始行
    	 * @param rowsInPage
    	 *            每页行数
    	 * @return
    	 */
    	public java.util.Collection loadData(String moduleId, String beanName,
    			String statementId, Object queryParam, int startIndex,
    			int rowsInPage);
    
    	/**
    	 *  获得数据总行数
    	 * @param moduleId 模块id
    	 * @param beanName bean名称
    	 * @param statementId 语句id
    	 * @param queryParam查询条件
    	 * @return
    	 */
    	public long loadDataTotalCount(String moduleId, String beanName,
    			String statementId, Object queryParam);
    }
    
    

评论功能维护中,当前仅展示历史评论。